I would like to distribute my application packaged as WAR embedded in Apache Tomcat. That is I want to distribute Tomcat along with my application.
How can this sort of distribution packaging can be done with Maven?
I have seen the Maven Cargo Plugin, but it appears to be geared towards deploying applications in containers locally. Perhaps an additional step over Cargo plugin is what I need. cargo:package
appears to be interesting but lacks documentation.
Right-click the maven project, click Run As —> Run Configurations menu item. Input clean install tomcat7:deploy in the Goals input text box deploy maven project to tomcat. Click Run button, when you see BUILD SUCCESS in the output console, that means the maven deploy to tomcat server process complete successfully.
The Tomcat Maven Plugin provides goals to manipulate WAR projects within the Apache Tomcat servlet container. Or to run your war project with an embedded Apache Tomcat. The run goals give you the opportunity to quickly develop your application without needing to install a standalone Tomcat instance.
Elaborating Tomasz's comment, you can do the following to achieve this.
Download and install tomcat to your local repository.
mvn install:install-file -DgroupId=org.apache -DartifactId=tomcat -Dversion=7.0.10 -Dpackaging=zip -Dfile=/path/to/file
Use unpack
goal of maven dependency plugin
to unzip tomcat to a work folder
maven assembly plugin
to place the application war in webapps folder and create a zipYou can refer to this pom.xml and this assembly descriptor.
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