我得到了一个maven项目来编译并部署到tomcat服务器上。在今天之前,我从未使用过maven,但我在谷歌上搜索了不少。这个项目中的顶级pom.xml文件似乎将打包类型设置为pom。
我应该做什么mvn安装后得到这个应用程序部署?我希望能在某个地方找到战争文件或其他东西,但我想我找错了地方或错过了一个步骤。
我得到了一个maven项目来编译并部署到tomcat服务器上。在今天之前,我从未使用过maven,但我在谷歌上搜索了不少。这个项目中的顶级pom.xml文件似乎将打包类型设置为pom。
我应该做什么mvn安装后得到这个应用程序部署?我希望能在某个地方找到战争文件或其他东西,但我想我找错了地方或错过了一个步骤。
当前回答
为了简单地回答您的问题,当您执行mvn:install时,maven将基于(pom.xml中的打包属性)创建一个打包的工件。运行maven install后,您可以找到扩展名为.package的文件
In target directory of the project workspace Also where your maven 2 local repository is search for (.m2/respository) on your box, Your artifact is listed in .m2 repository under (groupId/artifactId/artifactId-version.packaging) directory If you look under the directory you will find packaged extension file and also pom extension (pom extension is basically the pom.xml used to generate this package) If your maven project is multi-module each module will two files as described above except for the top level project that will only have a pom
其他回答
为了简单地回答您的问题,当您执行mvn:install时,maven将基于(pom.xml中的打包属性)创建一个打包的工件。运行maven install后,您可以找到扩展名为.package的文件
In target directory of the project workspace Also where your maven 2 local repository is search for (.m2/respository) on your box, Your artifact is listed in .m2 repository under (groupId/artifactId/artifactId-version.packaging) directory If you look under the directory you will find packaged extension file and also pom extension (pom extension is basically the pom.xml used to generate this package) If your maven project is multi-module each module will two files as described above except for the top level project that will only have a pom
https://maven.apache.org/pom.html
父和聚合(多模块)项目的打包类型必须是pom。这些类型定义了绑定到一组生命周期阶段的目标。例如,如果打包是jar,那么打包阶段将执行jar:jar目标。如果打包是pom,执行的目标将是site:附件-描述符
将工件打包为POM意味着它具有非常简单的生命周期
package -> install -> deploy
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
如果您正在部署一个pom.xml文件或一个不适合其他打包类型的项目,这是非常有用的。
我们对我们的许多项目使用pom包装,并适当地绑定额外的阶段和目标。
例如,我们的一些应用程序使用:
prepare-package -> test -> package -> install -> deploy
当你安装应用程序时,它应该将其添加到本地的.m2存储库中。要在其他地方发布,您需要设置正确的分发管理信息。如果maven没有自动附加工件,您可能还需要使用maven builder helper插件。
Pom打包只是一个说明主要工件不是war或jar,而是Pom .xml本身的规范。
它通常与“模块”一起使用,这些模块通常包含在项目的子目录中;但是,它也可以用于某些场景,即不需要构建主二进制文件,所有其他重要工件都声明为次要工件
想想一个“文档”项目,主要工件可能是一个PDF,但它已经构建好了,将其声明为次要工件的工作可能比告诉maven如何构建一个不需要编译的PDF的配置更重要。
pom的打包用于聚合其他项目的项目中,以及那些唯一有用的输出是来自某些插件的附加工件的项目中。在您的情况下,我猜您的顶级pom包括<modules>…</modules>聚合其他目录,实际输出是其他目录(可能是子目录)的结果。如果为了这个目的进行合理的编码,它就会有一种战争的包装。