diff --git a/src/it/download-licenses-force/licenses-errors.expected.xml b/src/it/download-licenses-force/licenses-errors.expected.xml index 10ccf4a95..9b3792850 100644 --- a/src/it/download-licenses-force/licenses-errors.expected.xml +++ b/src/it/download-licenses-force/licenses-errors.expected.xml @@ -17,7 +17,7 @@ - No URL for license at index 0 in dependency aopalliance:aopalliance + No URL for license at index 0 in dependency aopalliance:aopalliance:1.0 @@ -31,7 +31,7 @@ - No license information available for: groovy:groovy-all + No license information available for: groovy:groovy-all:1.0-jsr-04 diff --git a/src/main/java/org/codehaus/mojo/license/AbstractDownloadLicensesMojo.java b/src/main/java/org/codehaus/mojo/license/AbstractDownloadLicensesMojo.java index 5096790fc..2261b8252 100644 --- a/src/main/java/org/codehaus/mojo/license/AbstractDownloadLicensesMojo.java +++ b/src/main/java/org/codehaus/mojo/license/AbstractDownloadLicensesMojo.java @@ -1205,7 +1205,7 @@ private void downloadLicenses( LicenseDownloader licenseDownloader, ProjectLicen if ( matchingUrlsOnly && ( depProject.getLicenses() == null || depProject.getLicenses().isEmpty() ) ) { - handleError( depProject, "No license information available for: " + depProject ); + handleError( depProject, "No license information available for: " + depProject.toGavString() ); return; } @@ -1215,7 +1215,7 @@ private void downloadLicenses( LicenseDownloader licenseDownloader, ProjectLicen if ( matchingUrlsOnly && license.getUrl() == null ) { handleError( depProject, "No URL for license at index " + licenseIndex + " in dependency " - + depProject.toString() ); + + depProject.toGavString() ); } else if ( license.getUrl() != null ) { @@ -1308,20 +1308,20 @@ else if ( licenseOutputFile.exists() ) } catch ( URISyntaxException e ) { - handleError( depProject, "POM for dependency " + depProject.toString() + handleError( depProject, "POM for dependency " + depProject.toGavString() + " has an invalid license URL: " + licenseUrl ); getLog().debug( e ); } catch ( FileNotFoundException e ) { - handleError( depProject, "POM for dependency " + depProject.toString() + handleError( depProject, "POM for dependency " + depProject.toGavString() + " has a license URL that returns file not found: " + licenseUrl ); getLog().debug( e ); } catch ( IOException e ) { handleError( depProject, "Unable to retrieve license from URL '" + licenseUrl + "' for dependency '" - + depProject.toString() + "': " + e.getMessage() ); + + depProject.toGavString() + "': " + e.getMessage() ); getLog().debug( e ); } } @@ -1363,7 +1363,7 @@ private void handleError( ProjectLicenseInfo depProject, String msg ) throws Moj case failFast: throw new MojoFailureException( msg ); case xmlOutput: - getLog().debug( msg ); + getLog().error( msg ); depProject.addDownloaderMessage( msg ); break; default: 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 766fe5622..3c15392e3 100644 --- a/src/main/java/org/codehaus/mojo/license/download/LicensedArtifactResolver.java +++ b/src/main/java/org/codehaus/mojo/license/download/LicensedArtifactResolver.java @@ -169,7 +169,8 @@ public void loadProjectDependencies( ResolvedProjectDependencies artifacts, } catch ( ProjectBuildingException e ) { - laBuilder.errorMessage( e.getClass().getSimpleName() + ": " + e.getMessage() ); + laBuilder.errorMessage( "Could not create effective POM for '" + id + "': " + + e.getClass().getSimpleName() + ": " + e.getMessage() ); } depMavenProject = laBuilder.build(); diff --git a/src/main/java/org/codehaus/mojo/license/download/ProjectLicenseInfo.java b/src/main/java/org/codehaus/mojo/license/download/ProjectLicenseInfo.java index b4ac186cf..c66b686f3 100644 --- a/src/main/java/org/codehaus/mojo/license/download/ProjectLicenseInfo.java +++ b/src/main/java/org/codehaus/mojo/license/download/ProjectLicenseInfo.java @@ -173,6 +173,11 @@ public String toString() return getId(); } + public String toGavString() + { + return groupId + ":" + artifactId + ( version == null ? "" : ( ":" + version ) ); + } + /** * {@inheritDoc} */