I have a maven project that generates a .war file.
I want to configure maven to create an executable jar that embeds a servlet container (berth, tomcat or others) plus my military application and generates an executable jar that can launch my web application using a command, for example:
java -jar mywebapp.war
Is there a maven plugin to get such an artifact?
At the moment I am using jetty-runner to run a test version of my application, this is quite satisfactory for the test, but not as convenient for redistribution as it is for an executable war (for example, for jenkins).
Update
@ jesse-mcconnell: I do not want to change one line in my web application (except pom.xml) to achieve the result. It is just a matter of sharing my war in different ways and keeping it deployed under the selected application server, as well as being able to launch it as an executable war.
The ideal solution should also give me the opportunity to choose which application server will be deployed, as well as specify all the necessary configuration files contained in the executable war itself.
@khmarbaise: I know about jenkins, I already checked the code a long time ago, it uses the winstone servlet container and it puts Main.class in a war accessible from http (and I think this is wrong)
An ideal solution can create a war containing such things:
├── 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
- Main.class should use the default configuration etc, but is able to override the general parameters on the command line (port, context, etc.) or specify a new configuration.
- Main.class should be able to load the container container and configuration from the container (or extract it to tmp.dir) and start the application server.
This is how I do it.
In the end, you have a normal war that can be deployed on any application server, with the ability to run in an autonomous way.