2013-10-02 71 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

相關問題