【发布时间】:2015-10-02 17:54:43
【问题描述】:
我有客户要求 maven 项目生成战争,而战争又包含子模块作为 jar?
让我澄清一下这个问题
这是我的主 pom.xml,里面有两个名为 child1 和 child2 的模块。
我需要一个 MasterWebApp.war,其中包含 child1.jar 和 child2.jar。
如果我将包装更改为包装 - pom 然后错误消失但我无法在 maven clean install 时获得所需的战争
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc</groupId>
<artifactId>MasterWebApp</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Master Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<org.springframework.version>4.1.7.RELEASE</org.springframework.version>
</properties>
<modules>
<module>child1</module>
<module>child2</module>
</modules>
.......
【问题讨论】:
-
可以看maven文档
-
在 maven 文档中我可以找到主要项目打包为 pom 我无法将这些打包更改为战争。