我得到了一个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

Pom打包只是一个说明主要工件不是war或jar,而是Pom .xml本身的规范。

它通常与“模块”一起使用,这些模块通常包含在项目的子目录中;但是,它也可以用于某些场景,即不需要构建主二进制文件,所有其他重要工件都声明为次要工件

想想一个“文档”项目,主要工件可能是一个PDF,但它已经构建好了,将其声明为次要工件的工作可能比告诉maven如何构建一个不需要编译的PDF的配置更重要。

POM(项目对象模型)不过是构建项目的自动化脚本,我们可以用XML编写自动化脚本, 构建脚本文件在不同的自动化工具中有不同的名称

比如ANT里的build.xml, MAVEN里的pom.xml

MAVEN可以包装罐子,战争,耳朵和POM,这是我们所有人的新事物

如果你想检查什么是POM.XML

pom的打包用于聚合其他项目的项目中,以及那些唯一有用的输出是来自某些插件的附加工件的项目中。在您的情况下,我猜您的顶级pom包括<modules>…</modules>聚合其他目录,实际输出是其他目录(可能是子目录)的结果。如果为了这个目的进行合理的编码,它就会有一种战争的包装。

“pom”包装只是容器,它包含其他包/模块,如jar、war和ear。

如果你在外部包/容器上执行任何操作,比如MVN清洁编译安装。然后内部包/模块也得到干净的编译安装。

不需要为每个包/模块单独执行操作。