Maven 2 使用Antrun在Maven中拾取-Dattribute时出现问题

Maven 2 使用Antrun在Maven中拾取-Dattribute时出现问题,maven-2,maven-antrun-plugin,Maven 2,Maven Antrun Plugin,所以我的pom中有这个片段 <configuration> <target if="csc" > <echo>Unzipping md csc help</echo> </target> <target unless="csc"> <echo>Unzipping md help</echo> </target> </configuration&g

所以我的pom中有这个片段

<configuration>  
  <target if="csc" >
    <echo>Unzipping md csc help</echo>
  </target> 
  <target unless="csc">
    <echo>Unzipping md help</echo>
  </target>
</configuration>

解压md csc帮助
解压md帮助
当我使用mvn正常运行时,它会正确执行除非=“csc”目标。问题是,当我使用-Dcsc=true运行它时,它不会运行任何目标

我做错了什么?:)


谢谢。

解包可以通过完成。

看来antrun插件在配置中只支持一个目标元素。在以下情况下,您可以实现与激活相同的效果:


属性集
csc
org.apache.maven.plugins
maven antrun插件
1.6
antrun属性集
跑
生成源
属性已设置
属性未设置
!csc
org.apache.maven.plugins
maven antrun插件
1.6
未设置antrun属性
跑
生成源
属性未设置

无需使用Ant即可完成解压缩。。。
<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>