Re: [maven-and-scala] NPE when using incremental compiler with and without Zinc

190 views
Skip to first unread message

Peter Vlugter

unread,
Nov 20, 2012, 2:59:48 AM11/20/12
to maven-a...@googlegroups.com
Hi Glen,

Thanks. I'll take a closer look. I'll let you know if I need more info.

Peter


On 20/11/2012, at 10:47 AM, Glen Marchesani <gl...@model3.net> wrote:

>
> Does anyone have any guidance for this NPE? It happens after/during a clean install on a pretty basic scala project. I have tried to isolate the sequence of events to trigger it with no luck but it does happen intermittently and when it does I have to remove the <recompileMode>incremental</recompileMode> to get things compiling again.
>
> I am using version 3.1.0 of the scala-maven-plugin
>
> I am happy to isolate and post a project the reproduces the error to github if that helps diagnosing.... Or submit a patch.
>
>
> <plugin>
>
> <groupId>net.alchim31.maven</groupId>
> <artifactId>scala-maven-plugin</artifactId>
>
> <configuration>
> <recompileMode>incremental</recompileMode>
> <useZincServer>true</useZincServer>
> </configuration>
> <executions>
> <execution>
> <id>scala-compile-first</id>
> <phase>process-resources</phase>
> <goals>
> <goal>add-source</goal>
> <goal>compile</goal>
> </goals>
> </execution>
> <execution>
> <id>scala-test-compile</id>
> <phase>process-test-resources</phase>
> <goals>
> <goal>testCompile</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
>
>
>
> [INFO] Final Memory: 13M/258M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.1.0:compile (default) on project ahs-mobidash-scala: Execution default of goal net.alchim31.maven:scala-maven-plugin:3.1.0:compile failed. NullPointerException -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.1.0:compile (default) on project ahs-mobidash-scala: Execution default of goal net.alchim31.maven:scala-maven-plugin:3.1.0:compile failed.
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
> 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:84)
> at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
> at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
> at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
> at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
> at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
> at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal net.alchim31.maven:scala-maven-plugin:3.1.0:compile failed.
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
> ... 19 more
> Caused by: java.lang.NullPointerException
> at scala_maven.ScalaCompilerSupport.getAnalysisCacheMap(ScalaCompilerSupport.java:309)
> at scala_maven.ScalaCompilerSupport.incrementalCompile(ScalaCompilerSupport.java:287)
> at scala_maven.ScalaCompilerSupport.compile(ScalaCompilerSupport.java:118)
> at scala_maven.ScalaCompilerSupport.doExecute(ScalaCompilerSupport.java:99)
> at scala_maven.ScalaMojoSupport.execute(ScalaMojoSupport.java:400)
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
> ... 20 more

Peter Vlugter

unread,
Nov 22, 2012, 1:02:13 AM11/22/12
to maven-a...@googlegroups.com
Hi Glen,

On 22/11/2012, at 3:28 AM, Glen Marchesani <gl...@model3.net> wrote:

> In an effort to assist I pull the latest from git and am using a 3.1.1-SNAPSHOT version. I also noticed that zinc is now at 1.1.4 and upgraded to that as well. So far we haven't seen the problem again. That is running it on our 50 or so projects on 5 developer machines with no issues. Which before would have easily triggered the issue on at least one.

Okay, that's good news.

The location of the NPE is during reading of configuration for multi-module projects. I'll add extra null checks in there.

I don't think the zinc version will make any difference here, so it's possible that you'll see this problem again. Yes, 0.1.4 is the latest version to use with the maven plugin.

> So sorry for the false alarm. I hadn't realized we were running on older versions when I sent out the original email. If it does come I will email.

Thanks.

Peter

Peter Vlugter

unread,
Nov 22, 2012, 1:03:49 AM11/22/12
to maven-a...@googlegroups.com

On 22/11/2012, at 3:32 AM, Glen Marchesani <gl...@model3.net> wrote:

> An additional piece of good news is we were having problems with zinc on projects with java and scala files. That has gone away with the upgrades as well.
>
> Nice work on all this as we have a few java developers and a few scala developers and the java developers always grumble about how long it takes to build the scala code. The efforts on the incremental compile and the zinc compiler have provided for a significant reduction in build times anywhere from a 2x to 4x improvement.

Great to hear. That was certainly the goal.

Cheers,
Peter

Glen Marchesani

unread,
Nov 22, 2012, 10:17:12 AM11/22/12
to maven-a...@googlegroups.com

We did upgrade from 3.1.0 to 3.1.1-SNAPSHOT.  So I am going to hope/believe it is fixed until I see it broken ;-)

I think it is worth mentioning here the rough performance #'s are 15 minute 25 second "mvn clean install" without zinc and a 4 minute 20 second "mvn clean install" with it.. 

Peter Vlugter

unread,
Nov 22, 2012, 4:58:35 PM11/22/12
to maven-a...@googlegroups.com

On 23/11/2012, at 4:17 AM, Glen Marchesani <gl...@model3.net> wrote:

> I think it is worth mentioning here the rough performance #'s are 15 minute 25 second "mvn clean install" without zinc and a 4 minute 20 second "mvn clean install" with it..

Awesome! :)

Glen Marchesani

unread,
Nov 28, 2012, 9:54:32 PM11/28/12
to maven-a...@googlegroups.com, pvlu...@gmail.com
Hi Peter,
Any chance you added the guards to avoid the NPE?  If not I am happy to make those changes and setup a pull request.  If you have what branch (I looked around and didn't find them) and I am happy to test them out.

We had a few developers run into the NPE again.  We were using a build from master.

regards,
Glen


On Thu, Nov 22, 2012 at 1:02 AM, Peter Vlugter <pvlu...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages