10

I am trying to test on Intellij IDEA a scala maven project

when i run

mvn test

i get this error :

 Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.0:compile (scala-compile) on project neo4j-spark-connector: Execution scala-compile of goal net.alchim31.maven:scala-maven-plugin:3.2.0:compile failed: For artifact {null:null:null:jar}: The groupId cannot be empty.

this is the pom.xml i just added this dependency:

 <dependency>
    <groupId>neo4j-contrib</groupId>
    <artifactId>neo4j-spark-connector</artifactId>
     <version>2.1.0-M4</version>
 </dependency>

and this is the error logs :

[ERROR] Failed to execute goal net.alchim31.maven:scala-maven- plugin:3.2.0:compile (scala-compile) on project neo4j-spark-connector:   Execution scala-compile of goal net.alchim31.maven:scal
a-maven-plugin:3.2.0:compile failed: For artifact {null:null:null:jar}:  The groupId cannot be empty. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute   goal net.alchim31.maven:scala-maven-plugin:3.2.0:compile (scala-compile) on  project neo4j-spark-connector: Execution scala-compile of goal net.alchim31.maven:scala-maven-plugin:3.2.0:compile failed: For artifact {null:null:null:jar}: The groupId cannot be empty.
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:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
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 scala-compile of goal net.alchim31.maven:scala-maven-plugin:3.2.0:compile failed: For artifact {null:null:null:jar}:
The groupId cannot be empty.
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:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
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.artifact.InvalidArtifactRTException: For artifact {null:null:null:jar}: The groupId cannot be empty.
at org.apache.maven.artifact.DefaultArtifact.validateIdentity (DefaultArtifact.java:131)
at org.apache.maven.artifact.DefaultArtifact.<init> (DefaultArtifact.java:124)
at org.apache.maven.bridge.MavenRepositorySystem.createArtifactX (MavenRepositorySystem.java:565)
at org.apache.maven.bridge.MavenRepositorySystem.createArtifactX (MavenRepositorySystem.java:524)

..... this what i can post from error logs the site don't allow more How to fix it ?

A.HADDAD
  • 1,809
  • 4
  • 26
  • 51

3 Answers3

12

I found the same issue as mine here , so i upgraded the maven-scala-plugin to 3.3.3 instead of 3.2.0, the previous error is disappeared

A.HADDAD
  • 1,809
  • 4
  • 26
  • 51
  • 2
    FYI the latest version of scala-maven-plugin is 3.4.2 (release today). – David Bernard Jul 22 '18 at 21:24
  • Please note that one may need to upgrade the maven version as well along with that as old maven versions are not compatible with higher versions of this plugin – Albatross Aug 11 '22 at 20:51
3
  1. upgrade the version scala-maven-plugin to 3.4.2 if you're using a recent version of maven (like 3.5) because changes were made on dependeny management of maven.
  2. change the scope of scala-library dependency from provided to "compile" (or remove the scope). It's possible that "provided" scope generate trouble for "mvn test" (tbh I don't remember if provided are available in test)
  3. if you use the pom.xml of neo4j-spark-connector, I guess you try to compile neo4j-spark-connector, so why do you add itself as a dependency ? it could be the cause of your trouble (A depends of A)
David Bernard
  • 1,560
  • 13
  • 15
1

I was also having the same issue and what I found is: sometimes it is coming because of compilation errors also specifically when you are using intellij idea.

NickyPatel
  • 503
  • 4
  • 11