Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9093831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:12:08+00:00 2026-06-16T23:12:08+00:00

I have a maven project that is generating a .war file. I want to

  • 0

I have a maven project that is generating a .war file.

I want to configure maven to generate an executable jar, that embeds a servlet container (jetty, tomcat, or others) plus my war application, and generate an executable jar that can run my web application with a command like:

java -jar mywebapp.war

Is there a maven plugin to obtain such artifact?

At the moment I’m using jetty-runner to run a test version of my app, it’s quite satisfying for test, but not as as handy for redistribution as it would be an executable war (like in jenkins).

Update

@jesse-mcconnell: I don’t want to change a single line in my web application (except in the pom.xml) to achieve the result. It’s just a matter to package my war differently, and keep it deployable under an appserver of choice, plus having the ability to run it as an executable war.

A perfect solution should also give me the ability to choose which appserver to embed, also specifying all needed configuration files contained in the executable war itself.

@khmarbaise: I know about jenkins, I already checked the code long time back, it uses winstone servlet container, and it puts a Main.class in the war which is accessible from http (and I think it’s wrong)

A perfect solution could generate a war containing stuff like this:

├── META-INF 
│   └── MANIFEST.MF (Main-Class: WEB-INF.container.classes.Main)
└── WEB-INF
    ├── web.xml
    ├── classes
    ├── lib
    └── container
        ├── lib (jetty.jar/tomcat.jar/whatever.jar)
        ├── etc (configuration files for the container)
        └── classes
            └── Main.class 
  1. Main.class should use etc configuration as default, but being able to override common parameters at the command line (port, context,etc) or specifying a new configuration.
  2. Main.class should be able to load the container jar and configuration from inside the container (or extract into tmp.dir) and start up the appserver.

This is how I would make it.

At the end, you have a normal war, that can be deployed in any appserver, with the ability to run in a self-contained way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T23:12:09+00:00Added an answer on June 16, 2026 at 11:12 pm

    Tomcat Maven plugin do that have a look here http://tomcat.apache.org/maven-plugin-2.0/executable-war-jar.html

    HTH

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I have a simple maven project that is building a jar file and
I have a small maven project that build a java jar file. I added
I have a Maven based Spring-WS client project that I want to package as
I have a maven project that loads an xslt file and executes the transformation
I have a java project that is being built with Maven. Instead of generating
I have a maven project that I want to build without version. Now, when
I have a multi-module Maven project that makes use of WAR overlays (stack of
I have a java maven project that I want to unit test with scala.
I have maven project that consists of several modules. I want to add an
I have maven project that is built by Jenkins-CI. How to generate and publish

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.