2017-02-20 65 views
0

我只需要一個myEar.ear文件作爲我的maven版本的輸出。maven build ear - 我如何構建一個.ear文件而不是爆炸的耳朵?

我不想要目錄myEar(爆炸耳版)。

需要明確的是,這是我的構建輸出:

20/02/2017 11:37 <DIR>   myEar 
20/02/2017 11:37   7.985.535 myEar.ear 

我只想myEar.ear。

謝謝。

這裏我的耳朵的pom.xml:

<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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <name>myEar</name> 
    <description>myEar</description> 

    <groupId>com.foo</groupId> 
    <artifactId>myEar</artifactId> 
    <version>1.0</version> 
    <packaging>ear</packaging> 

    <parent> 
    </parent> 

    <properties> 
    </properties> 

    <dependencies> 

(...)

</dependencies> 

    <build> 
    <plugins> 


     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-ear-plugin</artifactId> 
     <version>2.8</version> 
     <configuration> 
      <defaultLibBundleDir>lib</defaultLibBundleDir> 
      <generatedDescriptorLocation>${basedir}/src/main/application/META-INF</generatedDescriptorLocation> 
      <modules> 
       <webModule> 
        <groupId>com.foo</groupId> 
        <artifactId>myWeb</artifactId>      
        <contextRoot>/myWeb</contextRoot> 
       </webModule> 
       <webModule> 
        <groupId>com.foo</groupId> 
        <artifactId>myWS</artifactId>      
        <contextRoot>/</contextRoot> 
       </webModule> 
      </modules> 
       <archive> 
        <addMavenDescriptor>false</addMavenDescriptor> 
       </archive> 
     </configuration> 
     </plugin> 
    </plugins> 

     <directory>${basedir}/../target/diraliases/EARHOMEDIR1036</directory> 
     <finalName>myEar</finalName> 

    </build> 

</project> 
+0

爲什麼要配置' $ {basedir}/..'?在當前模塊之外?你有沒有檢查'myEAR'文件夾裏面有什麼? – khmarbaise

+0

這是一個很長的故事......我需要在目錄上的耳朵投訴我公司的變更管理。無論如何.ear和文件夾都有相同的內容。 – tortugone

回答

0

我固定日Maven的antrun-插件...裏面行家螞蟻電話。 ..很髒...有人有一個更好的主意?

<plugin> 
    <artifactId>maven-antrun-plugin</artifactId> 
    <executions> 
     <execution> 
      <id>deleteDir</id> 
      <phase>package</phase> 
      <configuration> 
       <tasks> 
        <delete dir="${basedir}/../target/diraliases/EARHOMEDIR1036/myEar"/> 
       </tasks> 
      </configuration> 
      <goals> 
       <goal>run</goal> 
      </goals> 
     </execution> 
    </executions> 
</plugin>