Maven-基于概要文件从父POM调用模块
我有一个模块,它应该产生两个工件(war)。这两次战争的唯一区别在于所使用的web.xml。Maven-基于概要文件从父POM调用模块,maven,pom.xml,profiles,Maven,Pom.xml,Profiles,我有一个模块,它应该产生两个工件(war)。这两次战争的唯一区别在于所使用的web.xml。 我是在Maven个人资料的帮助下做的 <parent> <artifactId>com</artifactId> <groupId>myProj</groupId> <version>1.0</version> </parent> <groupId>myProj.modu
我是在Maven个人资料的帮助下做的
<parent>
<artifactId>com</artifactId>
<groupId>myProj</groupId>
<version>1.0</version>
</parent>
<groupId>myProj.module1</groupId>
<artifactId>module1</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<profiles>
<profile>
<id>module1</id>
<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>module1</warName>
<webXml>src\main\webapp\WEB-INF\web_module1.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>module2</id>
<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>module2</warName>
<webXml>src\main\webapp\WEB-INF\web_module2.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
通用域名格式
myProj
1
myProj.module1
模块1
1
战争
模块1
org.apache.maven.plugins
maven战争插件
模块1
src\main\webapp\WEB-INF\WEB\u module1.xml
模2
org.apache.maven.plugins
maven战争插件
模2
src\main\webapp\WEB-INF\WEB\u module2.xml
Q1:如何从超级POM调用此POM,以便激活两个配置文件?问题2:是否可以在本地存储库中安装两个生成的工件? 谢谢 如果需要,只需运行
mvn-Pprofile1,profile2
命令
然而,在您的例子中,这与Maven的一个主要约定相反,该约定规定one project=one artifact
。这意味着您不能同时创建两个WAR。如果您同时激活两个配置文件,则第二个配置文件将覆盖maven war插件的一个配置文件,然后,您将最终得到一个war,其中一个web.xml
如果您想得到两个war,解决方案是使用(即第二个war是另一个依赖于war#1的项目),或者运行两个单独的Maven命令,每个配置文件一个。谢谢romaintaz。有没有什么方法可以让我在个人资料的帮助下给我的孩子打电话。。。可以做的事情:…
嗯,我使用了“覆盖”。这两个工件使用相同的代码库,但“web.xml”不同