【问题标题】:maven-dependency-plugin not executing parent and child (goal)executionmaven-dependency-plugin 不执行父子(目标)执行
【发布时间】:2018-10-22 06:52:14
【问题描述】:

我有两个 maven-dependency-plugin 配置,一个在我的父模块中,一个在我的子模块中。父执行不只运行子执行。如果我手动将父执行复制(不移动)到子插件执行中,它可以工作,但我不想这样做,因为我还需要其他项目/子/模块的父配置。如果我注释掉子插件执行,它会运行父执行。

我的子插件执行是基于答案here

子 pom 配置(无论如何都会运行):

   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.8</version>
    <executions>
           <execution>
            <id>copy-model</id>
            <phase>package</phase>
            <goals>
                <goal>copy</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>my.test.pkg</groupId>
                        <artifactId>my-model</artifactId>
                        <classifier>server</classifier>
                        <version>1.0.3</version>
                        <type>jar</type>
                    </artifactItem>
                </artifactItems>
               <outputDirectory>${project.build.directory}/lib</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

父配置(仅在子 pom 中复制时运行):

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.8</version>
<executions>
       <execution>
        <id>build-classpath</id>
        <phase>generate-sources</phase>
        <goals>
            <goal>build-classpath</goal>
        </goals>
        <configuration>
             <outputFilterFile>true</outputFileterFile>
             <includeScope/>
             <fileSeparator/>
            <outputDirectory>${project.build.directory}/lib</outputDirectory>
        </configuration>
    </execution>
</executions>
</plugin>

【问题讨论】:

    标签: java maven pom.xml maven-assembly-plugin maven-dependency-plugin


    【解决方案1】:

    PluginManagement 在父 pom.xml 中有插件版本和插件配置,当你在子 pom 中继承时,这将禁止在父中执行。

    从 pluginManagement 中删除了配置/执行并修复了它。

    【讨论】:

      猜你喜欢
      • 2012-04-08
      • 2017-11-29
      • 1970-01-01
      • 2014-07-20
      • 1970-01-01
      • 1970-01-01
      • 2019-08-07
      • 2012-11-13
      • 2012-09-04
      相关资源
      最近更新 更多