Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix #314 ErrorRemedy.xmlOutput should log the issues on error level r… #315

Merged
merged 1 commit into from
Mar 28, 2019
Merged
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
4 changes: 2 additions & 2 deletions src/it/download-licenses-force/licenses-errors.expected.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</license>
</licenses>
<downloaderMessages>
<downloaderMessage>No URL for license at index 0 in dependency aopalliance:aopalliance</downloaderMessage>
<downloaderMessage>No URL for license at index 0 in dependency aopalliance:aopalliance:1.0</downloaderMessage>
</downloaderMessages>
</dependency>
<dependency>
Expand All @@ -31,7 +31,7 @@
<!-- Manually add license elements here: -->
</licenses>
<downloaderMessages>
<downloaderMessage>No license information available for: groovy:groovy-all</downloaderMessage>
<downloaderMessage>No license information available for: groovy:groovy-all:1.0-jsr-04</downloaderMessage>
</downloaderMessages>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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 )
{
Expand Down Expand Up @@ -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 );
}
}
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ public String toString()
return getId();
}

public String toGavString()
{
return groupId + ":" + artifactId + ( version == null ? "" : ( ":" + version ) );
}

/**
* {@inheritDoc}
*/
Expand Down