2016-05-03 22 views
0

現在、Mavenビルドを行っています。私はMavenビルドから特定のファイルを削除したい。私は現在、以下のコードをしようとしています:私は私のPOMでプロパティ値としてpropertyenvを定義しているMavenビルドから特定のファイルを削除できません

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <version>2.4</version> 
    <configuration> 
     <webResources> 
      <resource> 
       <directory>src/main/resources</directory> 
       <!-- override the destination directory for this resource --> 
       <targetPath>WEB-INF/classes</targetPath> 
       <!-- enable filtering --> 
       <filtering>true</filtering> 
       <includes> 
        <include>*.pem</include> 
        <include>*.pfx</include> 
        <include>META-INF/jpa-persistence.xml</include> 
        <include>META-INF/spring-persistence.xml</include> 
        <include>com/abc/config/build-config-${propertyenv}.properties</include> 
       </includes> 
       <excludes> 
        <exclude>%regex[(?!.*${propertyenv}/)*]</exclude> 
       </excludes> 
      </resource> 
     </webResources> 
    </configuration> 
</plugin> 

<properties> 
    <propertyenv>abc</propertyenv> 
</properties> 

は私だけcom/abc/configフォルダからabc.propertiesファイルをしたいです。しかし、ビルドした後にはすべて.propertiesファイルが存在します。親切に助けてください。最終戦争

例からファイルを含めるか除外する

+0

私は何を探していることだと思いますhttp://maven.apache.org/guides/ introduction/introduction-to-profiles.html – Abhishek

+0

@Abhishekどのようにビルドプロファイルがここで助けになるのですか?プロファイルを使用すると、その中で宣言されている値を使用して/ ovrerride設定をアクティブにします。設定自体がすでに実行しようとしていることをしていない場合、これはどのように役立ちますか? –

答えて

1

使用packagingExcludesまたはpackagingIncludesパラメータ:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <version>2.6</version> 
      .... 
    <configuration> 
      .... 
       <packagingExcludes> 
        WEB-INF/lib/pax-logging-*.jar, WEB-INF/lib/jaxb-*-2.2.7.jar 
       </packagingExcludes> 
    </configuration> 
</plugin> 
+0

ありがとう、それは働いた –