无法执行目标网。alchim31.maven:scala-maven-plugin:3.2.0:compile (scala-compile)

Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.0:compile (scala-compile)

我正在尝试在 Intellij IDEA 上测试 scala maven project

当我 运行

mvn 测试

我收到这个错误:

 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.

这是 pom.xml 我刚刚添加的依赖项:

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

这是错误日志:

[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)

....... 这是我可以从错误日志中 post 站点不允许更多 如何解决?

我发现和我的 here 一样的问题,所以我将 maven-scala-plugin 升级到 3.3.3 而不是 3.2.0,之前的错误消失了

  1. 如果您使用的是最新版本的 maven(如 3.5),请将 scala-maven-plugin 版本升级到 3.4.2,因为对 maven 的依赖管理进行了更改。
  2. 将 scala-library 依赖项的范围从提供更改为 "compile"(或删除范围)。 "provided" 范围可能会给 "mvn test" 带来麻烦(我不记得在测试中是否提供了)
  3. 如果你用的是neo4j-spark-connector的pom.xml,我猜你是在尝试编译neo4j-spark-connector,那你为什么要添加自己作为依赖?这可能是您遇到麻烦的原因(A 取决于 A)