Author: tchemit Date: 2008-10-13 20:04:11 +0000 (Mon, 13 Oct 2008) New Revision: 1204 Modified: maven-license-switcher-plugin/trunk/changelog maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/ThirdPartyMojo.java Log: Improve third-party goal : onyl keep included dependencies Modified: maven-license-switcher-plugin/trunk/changelog =================================================================== --- maven-license-switcher-plugin/trunk/changelog 2008-10-13 20:02:04 UTC (rev 1203) +++ maven-license-switcher-plugin/trunk/changelog 2008-10-13 20:04:11 UTC (rev 1204) @@ -1,4 +1,7 @@ -ver-0-8-2 thimel 20080922 +ver-0-4 chemit 20081013 + * 20081013 [chemit] Improve third-party goal : onyl keep included dependencies + +ver-0-3 chemit 20081013 * 20081013 [chemit] Improve licence resolving * 20080922 [thimel] Modified version of jrst and plugin's groupId * 20080922 [chemit] Using lutinpluginproject 3.0 Modified: maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/ThirdPartyMojo.java =================================================================== --- maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/ThirdPartyMojo.java 2008-10-13 20:02:04 UTC (rev 1203) +++ maven-license-switcher-plugin/trunk/src/main/java/org/codelutin/license/plugin/ThirdPartyMojo.java 2008-10-13 20:04:11 UTC (rev 1204) @@ -149,6 +149,15 @@ } thirdPartyFileContent = buildGroupedLicenses(licenseMap); + + // log dependencies with no license + SortedSet<String> dependenciesWithNoLicense = licenseMap.get(unknownLicenseMessage); + if (dependenciesWithNoLicense != null) { + for (String dep : dependenciesWithNoLicense) { + // no license found for the dependency + getLog().warn("no license found for dependency " + dep); + } + } } } @@ -191,9 +200,19 @@ } protected void buildLicenseMap(DependencyNode node, LicenseMap licenseMap) { - + if (node.getState() != DependencyNode.INCLUDED) { + // this dependency is not included, so do not treate it + if (verbose) { + getLog().info("do not include this dependency " + node.toNodeString()); + } + return; + } Artifact artifact = node.getArtifact(); + if (verbose && getLog().isDebugEnabled()) { + getLog().debug("treate node " + node.toNodeString()); + } + if (!Artifact.SCOPE_SYSTEM.equals(artifact.getScope())) { try { MavenProject artifactProject = getMavenProjectFromRepository(artifact); @@ -203,8 +222,6 @@ if (licenses.isEmpty()) { // no license found for the dependency - getLog().warn("no license found for dependency " + artifactName); - licenseMap.put(unknownLicenseMessage, artifactName); } else {