diff --git a/src/it/download-licenses-exclude-transitive-deps/invoker.properties b/src/it/download-licenses-exclude-transitive-deps/invoker.properties new file mode 100644 index 000000000..441ff83dd --- /dev/null +++ b/src/it/download-licenses-exclude-transitive-deps/invoker.properties @@ -0,0 +1 @@ +invoker.goals = clean validate -X diff --git a/src/it/download-licenses-exclude-transitive-deps/pom.xml b/src/it/download-licenses-exclude-transitive-deps/pom.xml new file mode 100644 index 000000000..7e2c00bb3 --- /dev/null +++ b/src/it/download-licenses-exclude-transitive-deps/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + + org.codehaus.mojo.license + it-test + 1.0-SNAPSHOT + Integration Test + http://maven.apache.org + + Check default execution. + + + + + org.wildfly + wildfly-ejb-client-bom + pom + 9.0.1.Final + + + junit + junit + 4.13.1 + + + + + + + org.codehaus.mojo + license-maven-plugin + @pom.version@ + + + exclude-pom + + download-licenses + + validate + + true + pom + ${project.build.directory}/generated-resources/licenses + ${project.build.directory}/generated-resources/licenses.xml + + + + + + + diff --git a/src/it/download-licenses-exclude-transitive-deps/postbuild.groovy b/src/it/download-licenses-exclude-transitive-deps/postbuild.groovy new file mode 100644 index 000000000..3681d8f98 --- /dev/null +++ b/src/it/download-licenses-exclude-transitive-deps/postbuild.groovy @@ -0,0 +1,51 @@ +/* + * #%L + * License Maven Plugin + * %% + * Copyright (C) 2008 - 2011 CodeLutin, Codehaus, Tony Chemit, Tony chemit + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * . + * #L% + */ +def assertExistsFile(file) +{ + if ( !file.exists() || file.isDirectory() ) + { + println(file.getAbsolutePath() + " file is missing or a directory.") + assert false + } + assert true +} + +def assertNotExistsFile(file) +{ + if ( file.exists() ) + { + println(file.getAbsolutePath() + " file should not exists.") + assert false + } + assert true +} + +file = new File(basedir, 'target/generated-resources/licenses/eclipse public license 1.0 - epl-v10.html'); +assertExistsFile(file); + +file = new File(basedir, 'target/generated-resources/licenses/lgpl - lgpl-2.1.txt'); +assertNotExistsFile(file); + +file = new File(basedir, 'target/generated-resources/licenses.xml'); +assertExistsFile(file); + +return true; diff --git a/src/it/download-licenses-exclude-transitive-deps/src/main/java/org/codehaus/mojo/HelloWorld.java b/src/it/download-licenses-exclude-transitive-deps/src/main/java/org/codehaus/mojo/HelloWorld.java new file mode 100644 index 000000000..16aaa7fed --- /dev/null +++ b/src/it/download-licenses-exclude-transitive-deps/src/main/java/org/codehaus/mojo/HelloWorld.java @@ -0,0 +1,15 @@ +package org.codehaus.mojo; + +public class HelloWorld +{ + + /** + * @param args + */ + public static void main( String[] args ) + { + // TODO Auto-generated method stub + + } + +} diff --git a/src/main/java/org/codehaus/mojo/license/download/LicensedArtifactResolver.java b/src/main/java/org/codehaus/mojo/license/download/LicensedArtifactResolver.java index 7a8f4a312..a23320a55 100644 --- a/src/main/java/org/codehaus/mojo/license/download/LicensedArtifactResolver.java +++ b/src/main/java/org/codehaus/mojo/license/download/LicensedArtifactResolver.java @@ -46,6 +46,7 @@ import org.codehaus.mojo.license.api.MavenProjectDependenciesConfigurator; import org.codehaus.mojo.license.api.ResolvedProjectDependencies; import org.codehaus.mojo.license.download.LicensedArtifact.Builder; +import org.codehaus.mojo.license.utils.MojoHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -132,7 +133,7 @@ public void loadProjectDependencies( continue; } - final String id = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion(); + final String id = MojoHelper.getArtifactId(artifact); if (verbose) { LOG.info("detected artifact {}", id); @@ -193,7 +194,7 @@ public void loadProjectDependencies( } if (remove) { - result.remove(entry.getKey()); + result.remove(MojoHelper.getArtifactId(entry.getValue())); } } }