Search code examples
javamavenpom.xmlmaven-assembly-pluginmaven-dependency-plugin

maven-dependency-plugin not executing parent and child (goal)execution


I have two maven-dependency-plugin configs, one in my parent module and one in my child module. The parent execution does not run only the child one. If i manually copy(not move)the parent execution into the child plugin execution it works, but i do not want to do this as i need the parent config for other projects/children/modules also. If i comment out the child plugin execution it runs the parent execution.

My child plugin execution is based on the answer here

Child pom config(which always runs regardless):

   <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>

Parent config(which only runs when duplicated in child 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>

Solution

  • PluginManagement had both plug-in version and plug-in configuration in the parent pom.xml , this prohibits execution in the parent when you then inherit in the child pom.

    Removed the configuration/execution from pluginManagement and this fixed it.