首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Maven maven-antrun-plugin跳过父任务

Maven maven-antrun-plugin跳过父任务
EN

Stack Overflow用户
提问于 2017-07-10 20:18:02
回答 1查看 666关注 0票数 1

我有一个包含maven ant任务的父pom,它需要由所有的孩子执行:

代码语言:javascript
复制
<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部分:

代码语言:javascript
复制
<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <configuration>
    <skip>true</skip>
  </configuration>
</plugin>

但是尽管有这个部分,任务总是会被执行。你知道我怎么才能有效地在这个孩子身上丢弃这个任务吗?

EN

回答 1

Stack Overflow用户

发布于 2017-08-05 00:46:57

这就是我如何在我自己的父级pom中实现它的:

代码语言:javascript
复制
<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},父对象管理器会拿起它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45011824

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档