In my parent POM, I defined a dependency plugin with phase prepare-package
inside <pluginManagement><plugins>
.
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${version.plugin.resources}</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>${version.plugin.dependency}</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${classpathDir}</outputDirectory>
<includeScope>runtime</includeScope>
<excludeClassifiers>${dependencyClassifiers}</excludeClassifiers>
</configuration>
</execution>
</executions>
</plugin>
In my child POM, I didn't specify any dependency plugin. It didn't get executed. I have to put this in <plugins>
to get it to trigger:
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
The Maven goals I'm using are clean install
.
My question is, why do I have to explicitly specify maven-dependency-plugin
again in my child POM?
- Other plugins like
maven-jar-plugin
,maven-resource-plugin
,maven-compiler-plugin
are running even though I didn't re-declare them in my POM. Why is it inconsistent? - dependency's phase was configured as
prepare-package
, which is beforepackage
phase in the Maven lifecycle, hence I presume it should have been "executed in the order given up to the point of the one specified". But it isn't, why?
Thanks in advance to anyone who is able to help with my enquiries! :)