Java scala maven插件的问题

Java scala maven插件的问题,java,scala,maven,Java,Scala,Maven,我尝试构建同时具有Scala和Java类的Maven项目: sudo mvn clean -X install -DskipTests 如何解决这个问题 [错误]无法执行目标 maven:scala maven插件:3.2.0:compile (scala先编译)在spark-streaming-flume-sink_2.10项目上: 执行scala编译目标的第一步 maven:scala maven插件:3.2.0:编译失败。 编译文件->[帮助1] org.apache.maven.lif

我尝试构建同时具有Scala和Java类的Maven项目:

sudo mvn clean -X install -DskipTests
如何解决这个问题

[错误]无法执行目标 maven:scala maven插件:3.2.0:compile (scala先编译)在spark-streaming-flume-sink_2.10项目上: 执行scala编译目标的第一步 maven:scala maven插件:3.2.0:编译失败。 编译文件->[帮助1] org.apache.maven.lifecycle.LifecycleExecutionException:未能 执行goal net.alchim31.maven:scala maven插件:3.2.0:compile (scala先编译)在spark-streaming-flume-sink_2.10项目上: 执行scala编译目标的第一步 maven:scala maven插件:3.2.0:编译失败。在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 在 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 在 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 在 org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 在 org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)上 org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)位于 org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)位于 org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)位于 org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)位于 org.apache.maven.cli.MavenCli.main(MavenCli.java:197)位于 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)位于 invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 位于java.lang.reflect.Method.invoke(Method.java:498) org.codehaus.plexus.classworlds.launcher.launchEnhanced(launcher.java:289) 在 org.codehaus.plexus.classworlds.launcher.launcher.launch(launcher.java:229) 在 org.codehaus.plexus.classworlds.launcher.launcher.mainWithExitCode(launcher.java:415) 在 org.codehaus.plexus.classworlds.launcher.launcher.main(launcher.java:356) 原因:org.apache.maven.plugin.PluginExecutionException:执行 scala编译第一个目标 maven:scala maven插件:3.2.0:编译失败。在 org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 20多个原因:编译在失败 调用(AnalyzingCompiler.scala:105) compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:48)位于 compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)位于 sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:99) 在 sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:99) 在 sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:99) 在 sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:166) 在 sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:98) 在 sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:143) 在 sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:87) 在 sbt.inc.IncrementalCompile$$anonfun$docomfile$1.apply(Compile.scala:39) 在 sbt.inc.IncrementalCompile$$anonfun$docomfile$1.apply(Compile.scala:37) 在sbt.inc.处,增量公共周期(增量scala:99)在 sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:38)位于 sbt.inc.Incremental$$anonfun$1.应用(Incremental.scala:37)于 sbt.inc.Incremental$.manageClassfiles(Incremental.scala:65)位于 sbt.inc.Incremental$.compile(Incremental.scala:37)在 sbt.inc.IncrementalCompile$.apply(Compile.scala:27)位于 sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:157) 在 sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:71) 在com.typesafe.zing.Compiler.compile(Compiler.scala:184)的 compile(Compiler.scala:164)位于 sbt_inc.SbtIncrementalCompiler.compile(SbtIncrementalCompiler.java:92) 在 scala_maven.ScalaCompilerSupport.incrementalCompile(ScalaCompilerSupport.java:303) 在 scala_maven.ScalaCompilerSupport.compile(ScalaCompilerSupport.java:119) 在 scala_maven.ScalaCompilerSupport.doExecute(ScalaCompilerSupport.java:99) 在scala_maven.ScalaMojoSupport.execute(ScalaMojoSupport.java:482) 在 org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)

pom.xml文件的一部分:


包裹
src/main/resources
真的
src/测试/资源
真的
org.apache.maven.plugins
maven资源插件
${project.build.sourceEncoding}
复制资源
net.alchim31.maven
scala maven插件
3.2.0
-目标:jvm-1.7
-来源
1.7
-目标
1.7
scala编译
公共关系
<build>
    <defaultGoal>package</defaultGoal>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
        <resource>
            <directory>src/test/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <configuration>
                <encoding>${project.build.sourceEncoding}</encoding>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
            <version>3.2.0</version>
            <configuration>
        <!--<recompileMode>incremental</recompileMode>-->
        <args>
            <arg>-target:jvm-1.7</arg>
        </args>
        <javacArgs>
            <javacArg>-source</javacArg>
            <javacArg>1.7</javacArg>
            <javacArg>-target</javacArg>
            <javacArg>1.7</javacArg>
        </javacArgs>
    </configuration>
    <executions>
        <execution>
            <id>scala-compile</id>
            <phase>process-resources</phase>
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
        <execution>
            <id>scala-test-compile</id>
            <phase>process-test-resources</phase>
            <goals>
                <goal>testCompile</goal>
            </goals>
        </execution>
    </executions>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>1.7</source>
        <target>1.7</target>
    </configuration>
    <executions>
        <execution>
            <phase>compile</phase>
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
    </executions>
</plugin>
  <dependencies>
    <dependency>
      <groupId>org.apache.flume</groupId>
      <artifactId>flume-ng-sdk</artifactId>
      <exclusions>
        <!-- Guava is excluded to avoid its use in this module. -->
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
        </exclusion>
        <!--
          Exclude libthrift since the flume poms seem to confuse sbt, which fails to find the
          dependency.
        -->
        <exclusion>
          <groupId>org.apache.thrift</groupId>
          <artifactId>libthrift</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.flume</groupId>
      <artifactId>flume-ng-core</artifactId>
      <exclusions>
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.thrift</groupId>
          <artifactId>libthrift</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-library</artifactId>
    </dependency>
    <dependency>
      <!-- Add Guava in test scope since flume actually needs it. -->
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <!--
        Netty explicitly added in test as it has been excluded from
        Flume dependency (to avoid runtime problems when running with
        Spark) but unit tests need it. Version of Netty on which
        Flume 1.4.0 depends on is "3.4.0.Final" .
      -->
      <groupId>io.netty</groupId>
      <artifactId>netty</artifactId>
      <version>3.4.0.Final</version>
      <scope>test</scope>
    </dependency>
  </dependencies>