Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #139 - "Can't find license-maven-plugin" (#1) #364

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: java
sudo: false
dist: trusty

# Skip the Travis CI's default install command
install: true
Expand Down
4 changes: 2 additions & 2 deletions src/it/add-third-party-no-encoding/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
# <http://www.gnu.org/licenses/lgpl-3.0.html>.
# #L%
###
invoker.goals=clean license:add-third-party
invoker.failureBehavior=fail-fast
invoker.goals=clean ${project.groupId}:${project.artifactId}:${project.version}:add-third-party
invoker.failureBehavior=fail-fast
13 changes: 0 additions & 13 deletions src/it/add-third-party-no-encoding/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,6 @@
<version>1.1.1</version>
</dependency>
</dependencies>
<build>

<pluginManagement>
<plugins>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>@pom.version@</version>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 )
Expand Down