【发布时间】:2015-05-22 08:18:39
【问题描述】:
我一直在使用 maven-ear-plugin 创建耳包并使用自定义 contextRoot 生成 application.xml(一切正常)。现在我想创建 2 个耳包并将它们部署在不同的上下文路径下,所以我定义了具有 2 个执行的插件。但是由于某种原因,maven-ear-plugin 忽略了 contextRoot 属性,并且在生成的 application.xml 中,它在两个耳朵中都使用 artifactId 而不是 contextRoot(因此它们具有相同的上下文根“app-ui”)。 这是我的 maven-ear-plugin 定义:
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>app1</id>
<phase>package</phase>
<goals>
<goal>ear</goal>
</goals>
<configuration>
<finalName>app1</finalName>
<modules>
<webModule>
<groupId>com.x.y</groupId>
<artifactId>app-ui</artifactId>
<contextRoot>/app1-ui</contextRoot>
</webModule>
</modules>
</configuration>
</execution>
<execution>
<id>app2</id>
<phase>package</phase>
<goals>
<goal>ear</goal>
</goals>
<configuration>
<finalName>app2</finalName>
<modules>
<webModule>
<groupId>com.x.y</groupId>
<artifactId>app-ui</artifactId>
<contextRoot>/app2-ui</contextRoot>
</webModule>
</modules>
</configuration>
</execution>
有什么建议吗?
【问题讨论】:
-
将
classifier添加到其中一项执行中,这意味着将`Second ' 添加到其中一项执行配置中并重试。 -
我尝试添加分类器,但结果仍然相同。它只是将分类器添加到耳朵文件名。
-
你能把示例项目或真实项目放在某个地方,这样看起来也更简单。
-
当然。我放在bitbucket上,可以克隆: git clone dd_repo@bitbucket.org/dd_repo/app.git 先构建app-ui,再构建app-ear。 app1.ear 和 app2.ear 都将被创建,并且两者都将在 META-INF/application.xml 中具有相同的上下文根
标签: java maven maven-ear-plugin