如何使用Maven将Web应用程序和tomcat打包在一起? [英] How do I package my web app and tomcat together using maven?
问题描述
我想分发嵌入到Apache Tomcat中的打包为WAR的应用程序.那就是我想随我的应用程序一起分发Tomcat.
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.
如何使用Maven完成这种分发包装?
How can this sort of distribution packaging can be done with Maven?
我已经看到 Maven Cargo插件,但它似乎适合在以下位置部署应用程序本地容器.也许我需要的是超越Cargo插件的其他步骤. cargo:package
似乎很有趣,但是缺少文档.
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.
推荐答案
详细说明Tomasz的注释,您可以执行以下操作来实现此目的.
Elaborating Tomasz's comment, you can do the following to achieve this.
-
下载tomcat并将其安装到本地存储库.
Download and install tomcat to your local repository.
mvn install:安装文件-DgroupId = org.apache -DartifactId = tomcat -Dversion = 7.0.10 -Dpackaging = zip -Dfile =/path/to/file
mvn install:install-file -DgroupId=org.apache -DartifactId=tomcat -Dversion=7.0.10 -Dpackaging=zip -Dfile=/path/to/file
使用maven dependency plugin
的unpack
目标将tomcat解压缩到工作文件夹
Use unpack
goal of maven dependency plugin
to unzip tomcat to a work folder
您可以参考此 pom.xml和
You can refer to this pom.xml and this assembly descriptor.
这篇关于如何使用Maven将Web应用程序和tomcat打包在一起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!