I'm currently writing a Maven plugin with automates releasing of modules by
maven-release-plugin
I'm trying to test it using the maven-invoker-plugin
, which uses the following setup in the integration-test poms:
<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<id>my-id</id>
<phase>generate-sources</phase>
<goals>
<goal>my-goal</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
The roadblock I'm hitting is that the maven-dependency-plugin
forbids this release since I reference a SNAPSHOT plugin in my pom.xml ( the @project.version@
above ). Fair enough.
I discovered that this check is made in CheckDependencySnapshotsPhase , which is a plexus component:
@plexus.component role="org.apache.maven.shared.release.phase.ReleasePhase" role-hint="check-dependency-snapshots"
Can I somehow override this component and plug in my own? Alternatively, how can I run this integration test without being blocked by the 'no snapshot depenendencies' check?
Turns out the answer was right in front of me. Instead of configuring the plugin in the IT project pom.xml, just instruct the maven-invoker-plugin
to execute it ( abridged ):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<goals>
<goal>package</goal>
<goal>${project.groupId}:${project.artifactId}:${project.version}:inspect-changes</goal>
</goals>
</configuration>
</plugin>