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

NullPointerException from ClassWrangler.getGroovyVersionString #210

Closed
jglick opened this issue Feb 9, 2022 · 4 comments
Closed

NullPointerException from ClassWrangler.getGroovyVersionString #210

jglick opened this issue Feb 9, 2022 · 4 comments
Milestone

Comments

@jglick
Copy link

jglick commented Feb 9, 2022

Unable to get Groovy version from GroovySystem, trying InvokerHelper.
[WARN] Unable to get Groovy version from InvokerHelper or GroovySystem, trying jar name.
Unable to determine Groovy version. Is Groovy declared as a dependency?
…
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.13.1:execute (…) on project …: Execution … of goal org.codehaus.gmavenplus:gmavenplus-plugin:1.13.1:execute failed.
	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:274)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:196)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:160)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.mvndaemon.mvnd.builder.SmartBuilderImpl.buildProject(SmartBuilderImpl.java:178)
	at org.mvndaemon.mvnd.builder.SmartBuilderImpl$ProjectBuildTask.run(SmartBuilderImpl.java:198)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution … of goal org.codehaus.gmavenplus:gmavenplus-plugin:1.13.1:execute failed.
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:148)
	at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:271)
	... 11 common frames omitted
Caused by: java.lang.NullPointerException: null
	at org.codehaus.gmavenplus.util.ClassWrangler.getGroovyVersionString(ClassWrangler.java:121)
	at org.codehaus.gmavenplus.util.ClassWrangler.logGroovyVersion(ClassWrangler.java:224)
	at org.codehaus.gmavenplus.mojo.ExecuteMojo.doExecute(ExecuteMojo.java:118)
	at org.codehaus.gmavenplus.mojo.ExecuteMojo.execute(ExecuteMojo.java:90)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	... 12 common frames omitted

seems to fail to account for a null return value from getGroovyJar.

@keeganwitt
Copy link
Member

Usually this happens because you don't have groovy as a project dependency. Can I see your POM?

@jglick
Copy link
Author

jglick commented Feb 10, 2022

Oh I long since solved the root problem—had an improper dependency somewhere. The point of the issue is that the mojo is throwing an NPE rather than gracefully reporting an error in this corner case. Or rather, it does log appropriate errors, but the immediate build failure cause is an NPE which grabs attention away from them.

@keeganwitt
Copy link
Member

I think that stacktrace only shows up when you are using a commandline switch such as debug (-X). But you're right, the message could be cleaned up.

keeganwitt added a commit that referenced this issue Feb 15, 2022
Throw exception instead of returning null when Groovy can't be found (closes #210)
@jglick
Copy link
Author

jglick commented Feb 16, 2022

a commandline switch such as debug (-X)

-e rather. If you do not, it is worse: you see that the mojo failed but you only see that there is a NullPointerException with no idea why.

@keeganwitt keeganwitt added this to the 1.13.2 milestone Jun 12, 2022
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