Hi,
I tried to run bloop in my company's project for the first time to play around with bloop. At first, I'm faced with #520, but manage to workaround it by commenting out the charset in configuration.
Now, maven is throwing NPE. Anything I can do to debug or help with it?
The project is a mixture of Java and Scala codebase, using scala-maven-plugin to compile both Java and Scala, and disabled maven-compiler plugin.
➜ TR git:(develop) ✗ mvn ch.epfl.scala:maven-bloop_2.10:1.2.5:bloopInstall -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< my.company.project >------------------
[INFO] Building My Company Project 1.0.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[WARNING] The artifact axis:axis-jaxrpc:jar:1.4 has been relocated to org.apache.axis:axis-jaxrpc:jar:1.4
[INFO]
[INFO] --- maven-bloop_2.10:1.2.5:bloopInstall (default-cli) @ mycompanyproject ---
[INFO] Using empty launcher: no run setup for My Company Project.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.548 s
[INFO] Finished at: 2019-04-25T13:36:18+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal ch.epfl.scala:maven-bloop_2.10:1.2.5:bloopInstall (default-cli) on project mycompanyproject: Execution default-cli of goal ch.epfl.scala:maven-bloop_2.10:1.2.5:bloopInstall failed.: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal ch.epfl.scala:maven-bloop_2.10:1.2.5:bloopInstall (default-cli) on project mycompanyproject: Execution default-cli of goal ch.epfl.scala:maven-bloop_2.10:1.2.5:bloopInstall failed.
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:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
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.PluginExecutionException: Execution default-cli of goal ch.epfl.scala:maven-bloop_2.10:1.2.5:bloopInstall failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
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:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
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: java.lang.NullPointerException
at sun.nio.fs.UnixPath.normalizeAndCheck (UnixPath.java:77)
at sun.nio.fs.UnixPath.<init> (UnixPath.java:71)
at sun.nio.fs.UnixFileSystem.getPath (UnixFileSystem.java:281)
at sun.nio.fs.AbstractPath.resolve (AbstractPath.java:53)
at bloop.integrations.maven.MojoImplementation$$anonfun$9.apply (MojoImplementation.scala:118)
at bloop.integrations.maven.MojoImplementation$$anonfun$9.apply (MojoImplementation.scala:118)
at scala.collection.TraversableLike$$anonfun$map$1.apply (TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply (TraversableLike.scala:244)
at scala.collection.immutable.List.foreach (List.scala:318)
at scala.collection.TraversableLike$class.map (TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map (Traversable.scala:105)
at bloop.integrations.maven.MojoImplementation$.writeConfig$1 (MojoImplementation.scala:118)
at bloop.integrations.maven.MojoImplementation$.writeCompileAndTestConfiguration (MojoImplementation.scala:130)
at bloop.integrations.maven.MojoImplementation.writeCompileAndTestConfiguration (MojoImplementation.scala)
at bloop.integrations.maven.BloopMojo.execute (BloopMojo.java:69)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
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:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
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)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/PluginExecutionException
@kai-ming-91 Thanks for reporting! The maven integration doesn't have a test suite in our repoository and therefore the quality of it is not equivalent to the quality of our other integrations, I apologize for that.
I don't understand why this issue is happening but it looks like this is the offending line:
The mojo.getBloopConfigDir is null and therefore the file constructor fails. I don't know what causes this issue.
A few questions/comments:
"net.alchim31.maven" % "scala-maven-plugin" % "3.2.2"Contributions on this area are welcome as I don't have the time to develop and maintain the Maven integration much lately. We have a few Maven bloop users but the plugin doesn't yet have the production-grade quality I'd like it to have.
What version of the Maven Scala plugin are you using? Bloop requires you use "net.alchim31.maven" % "scala-maven-plugin" % "3.2.2"
We are currently using version 3.3.2 in our project. I did try bumping up to 4.0.1, and downgrade to 3.2.2, but to no avail.
Beware when using the Maven bloop plugin with Java projects, so far Java projects are not supported #519
The project is fully compiling via scala-maven-plugin, with maven-compiler-plugin disabled. I assume it should be able to run fine.
I don't understand why this issue is happening but it looks like this is the offending line:
I just found out, it couldn't generate json file in .bloop folder. After some debug, this doesn't seems to be the offending line. This is:

The cause is in my project's pom, there are no targetPath define for resource:
<resources>
<resource>
<filtering>false</filtering>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/somefile</exclude>
</excludes>
</resource>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<includes>
<include>**/somefile</include>
</includes>
</resource>
<resource>
<filtering>false</filtering>
<directory>src/database/resources</directory>
</resource>
</resources>
The targetPath is not a required field as according to maven official documentation:
By default web resources are copied to the root of the WAR, as shown in the previous example. To override the default destination directory, specify the target path.
May I know how can I compile and install locally to test out my patch?
Thanks for looking into it!
May I know how can I compile and install locally to test out my patch?
Once you've done a change in the maven bloop plugin, you can go to the sbt shell and run install. Then, from Maven, you can use your plugin with $ mvn ch.epfl.scala:maven-bloop_2.10:$YOUR_LOCAL_VERSION:bloopInstall.
@jvican I saw you have already have it fixed 3 weeks back. And I've tried it locally and it's generating the bloop config file fine.
Thanks for the responsive help! :D
I'll close this issue instead.
@kai-ming-91 I'm surprised that commit fixed this issue 🤔 Anyway, I'm happy this error is gone, thank you for your time debugging this.
Most helpful comment
We are currently using version 3.3.2 in our project. I did try bumping up to 4.0.1, and downgrade to 3.2.2, but to no avail.
The project is fully compiling via scala-maven-plugin, with maven-compiler-plugin disabled. I assume it should be able to run fine.
I just found out, it couldn't generate json file in
.bloopfolder. After some debug, this doesn't seems to be the offending line. This is:https://github.com/scalacenter/bloop/blob/39837dbb275015a562ca83525aab3ae02d63c1f7/integrations/maven-bloop/src/main/scala/bloop/integrations/maven/MojoImplementation.scala#L118
The cause is in my project's pom, there are no
targetPathdefine forresource:The
targetPathis not a required field as according to maven official documentation:May I know how can I compile and install locally to test out my patch?