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

Let *download-licenses store the name of the downloaded file in licenses.xml #158

Closed
ppalaga opened this issue Nov 16, 2018 · 2 comments
Closed
Milestone

Comments

@ppalaga
Copy link
Contributor

ppalaga commented Nov 16, 2018

We create an HTML report out of licenses.xml where we are adding a link to the downloaded license file. It is currently impossible to reliably figure what the downloaded file name is. Thus I am proposing the following:

  1. There will be a new <file> element under <license> in licenses.xml.

  2. <file> would be written into licenses.xml by the AbstractDownloadLicensesMojo.

Any reason why I should not send a patch?

ppalaga added a commit to ppalaga/mojohaus-license-maven-plugin that referenced this issue Nov 16, 2018
@ppalaga
Copy link
Contributor Author

ppalaga commented Nov 16, 2018

Patch available in #157

ppalaga added a commit to ppalaga/mojohaus-license-maven-plugin that referenced this issue Nov 17, 2018
@ppalaga ppalaga changed the title AbstractDownloadLicensesMojo should store the name of the downloaded file in licenses.xml Let *download-licenses store the name of the downloaded file in licenses.xml Jan 4, 2019
@ppalaga ppalaga closed this as completed in bf7cfb6 Jan 4, 2019
ppalaga added a commit that referenced this issue Jan 4, 2019
Fix #158 Let *download-licenses store the name of the downloaded file…
@k-wall
Copy link
Contributor

k-wall commented Jan 9, 2019

Testing on master. I think I am seeing a regression caused by this change. If the license.xml exists but includes a reference to a license that previously failed to download (a 404 in my case), a second Maven invocation reports the following NPE.

I attach a license.xml.

licenses.xml.zip

I can see the failing case is from https://glassfish.java.net/public/CDDL+GPL_1_1.html (which gives a 404).

The XML stored for it lacks a <file> element.

 <license>
          <name>CDDL/GPLv2+CE</name>
          <url>https://glassfish.java.net/public/CDDL+GPL_1_1.html</url>
          <distribution>repo</distribution>
          <comments>CDDL or GPL version 2 plus the Classpath Exception</comments>
</license>
[ERROR] Failed to execute goal org.codehaus.mojo:license-maven-plugin:1.17-SNAPSHOT:download-licenses (download-thirdparty-licenses) on project keycloak-controller: Unable to parse license summary output file: /Users/keith/src/enmasse/keycloak-controller/target/classes/licenses/licenses.xml: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:license-maven-plugin:1.17-SNAPSHOT:download-licenses (download-thirdparty-licenses) on project keycloak-controller: Unable to parse license summary output file: /Users/keith/src/enmasse/keycloak-controller/target/classes/licenses/licenses.xml
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to parse license summary output file: /Users/keith/src/enmasse/keycloak-controller/target/classes/licenses/licenses.xml
	at org.codehaus.mojo.license.AbstractDownloadLicensesMojo.loadLicenseInfo(AbstractDownloadLicensesMojo.java:597)
	at org.codehaus.mojo.license.AbstractDownloadLicensesMojo.execute(AbstractDownloadLicensesMojo.java:334)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	... 20 more
Caused by: java.lang.NullPointerException
	at java.io.File.<init>(File.java:360)
	at org.codehaus.mojo.license.AbstractDownloadLicensesMojo.loadLicenseInfo(AbstractDownloadLicensesMojo.java:590)
	... 23 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

@ppalaga ppalaga added this to the 1.17 milestone Feb 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants