2012-04-13 11 views
2

Ich möchte nur bestimmte Dateien in maven-war-plugin ausschließen, wenn die Eigenschaft "skipCompress" auf true gesetzt ist, dachte ich, ich könnte sowas machen, aber es funktioniert nicht mich. Übrigens kann ich das Profil nicht verwenden, um dies zu erreichen. Ich möchte skipCompress verwenden, um die Komprimierung in Entwicklungs- und Bereitstellungsprofilen ein- und auszuschalten.Bedingte Konfiguration in maven pom.xml

<plugin> 
    <artifactId>maven-war-plugin</artifactId> 
    <configuration> 
    <if> 
     <not> 
     <equals arg1="${skipCompress}" arg2 = "true"/> 
     </not> 
     <then> 
     <warSourceExcludes>**/external/dojo/**/*.js</warSourceExcludes> 
     </then> 
    </if> 
    </configuration> 
</plugin> 

Danke,

David

+0

Sie haben die Antwort selbst gegeben. Verwenden Sie Profile für diese Art. – khmarbaise

Antwort

2

Ohne wirklich Maven Profile zu verstehen, löste ich ein ähnliches Problem mit einem Muster wie die folgenden verwendet. Vielleicht ist es auch in Ihrem Fall hilfreich.

<profiles> 
    <profile> 
    <id>skipCompress</id> 
    <activation> 
     <property> 
     <name>skipCompress</name> 
     <value>true</value> 
     </property> 
    </activation> 
    <build> 
     <plugins> 
     <plugin> 
      <artifactId>maven-war-plugin</artifactId> 
      <configuration> 
      <warSourceExcludes>**/external/dojo/**/*.js</warSourceExcludes> 
      </configuration> 
     </plugin> 
     </plugins> 
    </build> 
    </profile> 
</profiles> 
+0

'' Element der settings.xml hat kein '' Element: http://maven.apache.org/ref/2.2.1/maven-settings/settings.html – maksimov

+0

Es wird in der 'pom.xml unterstützt ': https://maven.apache.org/ref/3.1.0/maven-model/maven.html – ralfstx

+0

danke @ralfstx, ich war/bin besessen davon, es über die globale Konfiguration arbeiten zu lassen. – maksimov

Verwandte Themen