So I have this snippet in my pom
<configuration>
<target if="csc" >
<echo>Unzipping md csc help</echo>
</target>
<target unless="csc">
<echo>Unzipping md help</echo>
</target>
</configuration>
When I run wit开发者_StackOverflow中文版h mvn normally it correctly executes the unless="csc" target. The problem is that when I run it with -Dcsc=true it does not run any of the targets.
What am I doing wrong? :)
Thanks
It seems the antrun plugin supports only a single target element in the configuration. You can achieve the same effect with maven profiles that get activated when the property is set or absent:
<profiles>
<profile>
<id>property-set</id>
<activation>
<property>
<name>csc</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>antrun-property-set</id>
<goals>
<goal>run</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<target>
<echo>property is set</echo>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>property-not-set</id>
<activation>
<property>
<name>!csc</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>antrun-property-not-set</id>
<goals>
<goal>run</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<target>
<echo>property is not set</echo>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
The unpacking can be done via the maven-dependency plugin.
精彩评论