我有一个包含maven ant任务的父pom,它需要由所有的孩子执行:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>set-scripts-rights</id>
<phase>initialize</phase>
<configuration>
<tasks>
<!-- The tasks that needs to be exacuted-->
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
在其中一个子类中,我不希望脚本被执行,然后我将这个添加到了build / plugins部分:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
但是尽管有这个部分,任务总是会被执行。你知道我怎么才能有效地在这个孩子身上丢弃这个任务吗?
发布于 2017-08-05 00:46:57
这就是我如何在我自己的父级pom中实现它的:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>set-scripts-rights</id>
<phase>initialize</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<skip>${skip.property.name}</skip>
<tasks> <!-- NOTE: tasks is deprecated, consider using target instead -->
<!-- The tasks that needs to be executed-->
</tasks> <!-- NOTE: tasks is deprecated, consider using target instead -->
</configuration>
</execution>
</executions>
</plugin>在触发子对象时,设置属性${skip.property.name},父对象管理器会拿起它。
https://stackoverflow.com/questions/45011824
复制相似问题