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).
@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
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.
Tomcat Maven plugin do that have a look here http://tomcat.apache.org/maven-plugin-2.0/executable-war-jar.html
HTH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With