2013-10-02 69 views
0

当我想要使用Maven的EAR插件两个的.war文件打包成一个.ear文件:的Maven插件EAR包战争文件两次使用bundleFileName

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-ear-plugin</artifactId> 
    <version>2.8</version> 
    <executions> 
     <execution> 
      <id>package-mae</id> 
      <phase>package</phase> 
      <configuration> 
       <version>6</version> 
       <modules> 
        <webModule> 
         <groupId>de.ast</groupId> 
         <artifactId>mae-mobile</artifactId> 
         <contextRoot>/mobile</contextRoot> 
         <bundleFileName>/mae-mobile.war</bundleFileName> 
        </webModule> 
        <webModule> 
         <groupId>de.ast</groupId> 
         <artifactId>mae-rest</artifactId> 
         <contextRoot>/api</contextRoot> 
         <bundleFileName>/mae-rest.war</bundleFileName> 
        </webModule> 
       </modules> 
      </configuration> 
      <goals> 
       <goal>generate-application-xml</goal> 
       <goal>ear</goal> 
      </goals> 
     </execution> 
    </executions> 
</plugin> 

它可以很好地除了一个事实,即战争文件包两次,每次,即耳朵文件包含:

  • MAE-rest.war
  • MAE-休息-0.0.1-SNAPSHOT.war
  • MAE-mobile.war
  • mae-mobile-0.0.1-SNAPSHOT.war

如何避免此重复?

感谢, 罗纳德

+0

你试过做'mvn clean package' – khmarbaise

+0

感谢你的建议 - 但我做了一个'mvn clean package' – Ronald

+0

你可以尝试删除软件包文件名中的前导斜杠。 – khmarbaise

回答

0

我会建议改变,你必须为以下配置:

<build> 
    <plugins> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-ear-plugin</artifactId> 
     <version>2.8</version> 
     <configuration> 
      <version>6</version> 
      <modules> 
       <webModule> 
        <groupId>de.ast</groupId> 
        <artifactId>mae-mobile</artifactId> 
        <contextRoot>/mobile</contextRoot> 
        <bundleFileName>mae-mobile.war</bundleFileName> 
       </webModule> 
       <webModule> 
        <groupId>de.ast</groupId> 
        <artifactId>mae-rest</artifactId> 
        <contextRoot>/api</contextRoot> 
        <bundleFileName>mae-rest.war</bundleFileName> 
       </webModule> 
      </modules> 
      <generateApplicationXml>true</generateApplicationXml> 
     </configuration> 
     </plugin> 
     ... 
    </plugins> 
</build> 

这应该解决您的问题。

+0

嗨,谢谢 - 完美的作品。发生这种情况时,从互联网复制的东西:-)谢谢,罗纳德 – Ronald

相关问题