license-maven-plugin icon indicating copy to clipboard operation
license-maven-plugin copied to clipboard

Is multimodule working when using aggregate-add-third-party?

Open v1v opened this issue 6 years ago • 12 comments

For some reason when I use 1.14 version plus the '--projects' flag to just run the aggregate goal. it skips the multimodule as you can see below:

 mvn license:aggregate-add-third-party -Pgenerate-third-party -pl multimodule-with-war-util
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building multimodule-with-war-util 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- license-maven-plugin:1.14:aggregate-add-third-party (default-cli) @ multimodule-with-war-util ---
[WARNING] The goal is skip due to packaging 'jar'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

while if I use 1.13 it works as expected

 mvn license:aggregate-add-third-party -Pgenerate-third-party -pl multimodule-with-war-util
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building multimodule-with-war-util 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> license-maven-plugin:1.13:aggregate-add-third-party (default-cli) > :add-third-party @ multimodule-with-war-util >>>
[INFO] 
[INFO] --- license-maven-plugin:1.13:add-third-party (add-third-party) @ multimodule-with-war-util ---
[WARNING] No license name defined for org.apache.xbean--xbean-asm5-shaded--3.17
[WARNING] No license name defined for org.apache.xbean--xbean-asm5-shaded--3.17
[WARNING] There is 1 dependencies with no license :
[WARNING]  - stax--stax--1.2.0
[INFO] Writing third-party file to /Users/victor/work/temp/multimodule-with-war/multimodule-with-war-util/target/generated-sources/license/THIRD-PARTY.txt
[INFO] 
[INFO] <<< license-maven-plugin:1.13:aggregate-add-third-party (default-cli) < :add-third-party @ multimodule-with-war-util <<<
[INFO] 
[INFO] 
[INFO] --- license-maven-plugin:1.13:aggregate-add-third-party (default-cli) @ multimodule-with-war-util ---
[WARNING] The goal is skip due to packaging 'jar'

Someone else already posted this issue: https://github.com/mojohaus/license-maven-plugin/issues/93 and I was able to reproduce in my multimodule project.

Any hints?

Thanks

v1v avatar Oct 09 '17 22:10 v1v

Hi. Goal aggregate-add-third-party does not work for me, too. I always get "You should use missingFile parameter instead of deprecated aggregateMissingLicensesFile." although I use missingFile instead of aggregateMissingLicensesFile. Looking into code, probably aggregateMissingLicensesFile still has its default value and won't be null at any time?

Workaround: Set aggregateMissingLicensesFile to the same value as missingFile

But even with the workaround, the missingFileUrl won't be used at all and the missingFile won't be generated.

TorstenKruse avatar Jun 25 '18 12:06 TorstenKruse

I recently merged a couple of fixes in this area. Could you please reproduce using a SNAPSHOT built from the current master?

ppalaga avatar Jan 04 '19 14:01 ppalaga

Using the current master snapshot I get an error on execution on my windows 10.

[11:49:32] [ERROR] Failed to execute goal org.codehaus.mojo:license-maven-plugin:1.17-SNAPSHOT:add-third-party (default-cli) on project pad: could not execute goal AddThirdPartyMojo for reason : \dev\null (Das System kann den angegebenen Pfad nicht finden) -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:license-maven-plugin:1.17-SNAPSHOT:add-third-party (default-cli) on project pad: could not execute goal AddThirdPartyMojo for reason : \dev\null (Das System kann den angegebenen Pfad nicht finden)

Root cause is:

Caused by: java.io.FileNotFoundException: \dev\null (Das System kann den angegebenen Pfad nicht finden) at java.base/java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:220) at java.base/java.io.FileInputStream.(FileInputStream.java:158) at java.base/java.io.FileInputStream.(FileInputStream.java:113) at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86) at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:184) at java.base/java.net.URL.openStream(URL.java:1117) at org.codehaus.mojo.license.api.DefaultThirdPartyTool.overrideLicenses(DefaultThirdPartyTool.java:618) at org.codehaus.mojo.license.AbstractAddThirdPartyMojo.overrideLicenses(AbstractAddThirdPartyMojo.java:1002) at org.codehaus.mojo.license.AbstractAddThirdPartyMojo.consolidate(AbstractAddThirdPartyMojo.java:751) at org.codehaus.mojo.license.AddThirdPartyMojo.doAction(AddThirdPartyMojo.java:173) at org.codehaus.mojo.license.AbstractLicenseMojo.execute(AbstractLicenseMojo.java:202)

TorstenKruse avatar Jan 09 '19 10:01 TorstenKruse

@TorstenKruse Sorry for that. It is probably my fault. It is a pity that we still do not have a Windows CI. I am waiting for Mojohaus folks to check why it does not work yet.

ppalaga avatar Jan 09 '19 11:01 ppalaga

@TorstenKruse could you please re-try now after I merged https://github.com/mojohaus/license-maven-plugin/pull/194 ?

ppalaga avatar Jan 09 '19 12:01 ppalaga

@ppalaga After pulling current master the former exception is gone. But another arises. Would be nice to get another fix.

[14:34:18] [ERROR] Failed to execute goal org.codehaus.mojo:license-maven-plugin:1.17-SNAPSHOT:aggregate-download-licenses (default-cli) on project pad: Unable to parse license summary output file: e:\Projects_git\pad\target\generated-resources\licenses.xml: NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:license-maven-plugin:1.17-SNAPSHOT:aggregate-download-licenses (default-cli) on project pad: Unable to parse license summary output file: e:\Projects_git\pad\target\generated-resources\licenses.xml at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 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:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) 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: e:\Projects_git\pad\target\generated-resources\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:207) ... 20 more Caused by: java.lang.NullPointerException at java.base/java.io.File.(File.java:359) at org.codehaus.mojo.license.AbstractDownloadLicensesMojo.loadLicenseInfo(AbstractDownloadLicensesMojo.java:590) ... 23 more

TorstenKruse avatar Jan 09 '19 13:01 TorstenKruse

@TorstenKruse could you please check after https://github.com/mojohaus/license-maven-plugin/pull/198 was merged?

ppalaga avatar Jan 10 '19 18:01 ppalaga

Build is successful now! But the strange warning is still there.

First the goal add-third-party is executed for each module of the multi-module project. This is fine. At last the aggregate-add-third-party is executed for the complete project and it still starts with the following messagen:

[08:29:58] [INFO] --- license-maven-plugin:1.17-SNAPSHOT:aggregate-add-third-party (default-cli) @ pad --- [08:29:58] [WARNING] [08:29:58] [WARNING] You should use missingFile parameter instead of deprecated aggregateMissingLicensesFile. [08:29:58] [WARNING] [08:29:58] [INFO] All files are up to date, skip goal execution.

TorstenKruse avatar Jan 11 '19 07:01 TorstenKruse

@TorstenKruse thanks for your effort. From what you say, I am not sure what of the following is true:

  1. The current issue (as originally described) is still reproducible
  2. The warning about missingFile and aggregateMissingLicensesFile is misleading but otherwise the mojo behaves as expected.

Could you please confirm or deny these two statements?

ppalaga avatar Jan 11 '19 07:01 ppalaga

Well, I'm not 100% sure too because my original fault was slightly different from the inital one of this issue. I think we should ask @v1v . For him the check did not run properly because of packaging jar combined with aggregate goal. For me the check did not run properly because the missingFileUrl was not handeled properly in aggregate.

When I try packaging "jar" for my multi-module project I get

'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging from maven.

So I cannot reproduce your first point. The second one seems to be ok for me now except of the really misleading message which should be removed.

TorstenKruse avatar Jan 11 '19 09:01 TorstenKruse

OK, let's keep this open, although I cannot tell this is a bug. An integration test demonstrating the issue would be highly welcome.

As for the the warning about missingFile and aggregateMissingLicensesFile, @TorstenKruse feel free to open a new issue.

ppalaga avatar Jan 11 '19 10:01 ppalaga

ok, i created #207

TorstenKruse avatar Jan 14 '19 09:01 TorstenKruse