groovy / gmaven

Groovy integration for Maven
http://groovy.github.io/gmaven/
Apache License 2.0
51 stars 21 forks source link

Error in case any previously executed plugin inserts null valued property #14

Closed iiliev2 closed 5 years ago

iiliev2 commented 5 years ago

https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/util/PropertiesBuilder.java#L81

I am using https://github.com/apache/jackrabbit-filevault-package-maven-plugin which appears to be inserting a null valued property. GMaven cannot prepare the properties in this case, because it uses Guava's immutable maps which do not permit this.

jdillon commented 5 years ago

do you have a stack trace? Properties, which extends Hashtable doesn't support null value. I can adjust the use of guava helpers here but atm I'm not sure how the Properties ends up with a entry with a null value to trigger this.

iiliev2 commented 5 years ago

[ERROR] Failed to execute goal org.codehaus.gmaven:groovy-maven-plugin:2.1:execute (clean bundles) on project third-party: Execution clean bundles of goal org.codehaus.gmaven:groovy-maven-plugin:2.1:execute failed: null value in entry: vault.embeddedfiles.map=null -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.gmaven:groovy-maven-plugin:2.1:execute (clean bundles) on project third-party: Execution clean bundles of goal org.codehaus.gmaven:groovy-maven-plugin:2.1:execute failed: null value in entry: vault.embeddedfiles.map=null 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 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) at org.codehaus.classworlds.Launcher.main(Launcher.java:47) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution clean bundles of goal org.codehaus.gmaven:groovy-maven-plugin:2.1:execute failed: null value in entry: vault.embeddedfiles.map=null at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) ... 21 more Caused by: java.lang.NullPointerException: null value in entry: vault.embeddedfiles.map=null at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:235) at com.google.common.collect.ImmutableMap.entryOf(ImmutableMap.java:144) at com.google.common.collect.ImmutableMap$Builder.put(ImmutableMap.java:182) at com.google.common.collect.Maps.fromProperties(Maps.java:1191) at org.codehaus.gmaven.plugin.util.PropertiesBuilder.build(PropertiesBuilder.java:81) at org.codehaus.gmaven.plugin.RuntimeMojoSupport.createProperties(RuntimeMojoSupport.java:322) at org.codehaus.gmaven.plugin.RuntimeMojoSupport.createContext(RuntimeMojoSupport.java:346) at org.codehaus.gmaven.plugin.ExecuteMojo.run(ExecuteMojo.java:91) at org.codehaus.gmaven.plugin.MojoSupport.execute(MojoSupport.java:47) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) ... 22 more

jdillon commented 5 years ago

@iiliev2 2.1.1-SNAPSHOT build with changes to better cope with properties that may contain a null value is up here if you want to try it out:

jdillon commented 5 years ago

2.1.1 has been released, will be in central shortly.

iiliev2 commented 5 years ago

It works! Thank you very much. The log now displays: [WARNING] Ignoring null property: vault.embeddedfiles.map