diff --git a/src/it/add-third-party-no-encoding/invoker.properties b/src/it/add-third-party-no-encoding/invoker.properties index 09bf32591..a017991af 100644 --- a/src/it/add-third-party-no-encoding/invoker.properties +++ b/src/it/add-third-party-no-encoding/invoker.properties @@ -19,5 +19,5 @@ # . # #L% ### -invoker.goals=clean license:add-third-party -invoker.failureBehavior=fail-fast \ No newline at end of file +invoker.goals=clean ${project.groupId}:${project.artifactId}:${project.version}:add-third-party +invoker.failureBehavior=fail-fast diff --git a/src/it/add-third-party-no-encoding/pom.xml b/src/it/add-third-party-no-encoding/pom.xml index b6d0849a1..ca27c0635 100644 --- a/src/it/add-third-party-no-encoding/pom.xml +++ b/src/it/add-third-party-no-encoding/pom.xml @@ -45,19 +45,6 @@ 1.1.1 - - - - - - - org.codehaus.mojo - license-maven-plugin - @pom.version@ - - - - diff --git a/src/main/java/org/codehaus/mojo/license/AggregatorAddThirdPartyMojo.java b/src/main/java/org/codehaus/mojo/license/AggregatorAddThirdPartyMojo.java index e5a9acf53..2c5745e0c 100644 --- a/src/main/java/org/codehaus/mojo/license/AggregatorAddThirdPartyMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AggregatorAddThirdPartyMojo.java @@ -33,6 +33,7 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.model.Plugin; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.descriptor.PluginDescriptor; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -203,11 +204,30 @@ protected void doAction() } if ( groupId == null ) { - throw new IllegalStateException( "Can't find license-maven-plugin" ); + try + { + final PluginDescriptor pd = ( PluginDescriptor ) getPluginContext().get( "pluginDescriptor" ); + groupId = pd.getGroupId(); + artifactId = pd.getArtifactId(); + version = pd.getVersion(); + } + catch ( ClassCastException e ) + { + LOG.warn( "Failed to access PluginDescriptor", e ); + } + + if ( groupId == null ) + { + throw new IllegalStateException( "Failed to determine the license-maven-plugin artifact." + + + "Please add it to your parent POM." ); + } } String addThirdPartyRoleHint = groupId + ":" + artifactId + ":" + version + ":" + "add-third-party"; + LOG.info( "The default plugin hint is: " + addThirdPartyRoleHint ); + for ( MavenProject reactorProject : reactorProjects ) { if ( getProject().equals( reactorProject ) && !acceptPomPackaging )