title: Issue with scala-maven-plugin
body: <p>I try to build the Maven project that has both Scala and Java classes:</p>
  
  <pre><code>sudo mvn clean -X install -DskipTests
  </code></pre>
  
  <p>How to solve this issue?</p>
  
  <blockquote>
    <p>[ERROR] Failed to execute goal
    net.alchim31.maven:scala-maven-plugin:3.2.0:compile
    (scala-compile-first) on project spark-streaming-flume-sink_2.10:
    Execution scala-compile-first of goal
    net.alchim31.maven:scala-maven-plugin:3.2.0:compile failed.
    CompileFailed -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
    execute goal net.alchim31.maven:scala-maven-plugin:3.2.0:compile
    (scala-compile-first) on project spark-streaming-flume-sink_2.10:
    Execution scala-compile-first of goal
    net.alchim31.maven:scala-maven-plugin:3.2.0:compile failed.   at
    org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
      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:116)
      at
    org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
      at
    org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
      at
    org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)   at
    org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)    at
    org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)  at
    org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)  at
    org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)   at
    org.apache.maven.cli.MavenCli.main(MavenCli.java:197)     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-first of goal
    net.alchim31.maven:scala-maven-plugin:3.2.0:compile failed.   at
    org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
      at
    org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      ... 20 more Caused by: Compilation failed   at
    sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:105)  at
    sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:48)    at
    sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)    at
    sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:99)
      at
    sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:99)
      at
    sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:99)
      at
    sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:166)
      at
    sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:98)
      at
    sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:143)
      at
    sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:87)
      at
    sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:39)
      at
    sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:37)
      at sbt.inc.IncrementalCommon.cycle(Incremental.scala:99)    at
    sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:38)    at
    sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:37)    at
    sbt.inc.Incremental$.manageClassfiles(Incremental.scala:65)   at
    sbt.inc.Incremental$.compile(Incremental.scala:37)    at
    sbt.inc.IncrementalCompile$.apply(Compile.scala:27)   at
    sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:157)
      at
    sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:71)
      at com.typesafe.zinc.Compiler.compile(Compiler.scala:184)   at
    com.typesafe.zinc.Compiler.compile(Compiler.scala:164)    at
    sbt_inc.SbtIncrementalCompiler.compile(SbtIncrementalCompiler.java:92)
      at
    scala_maven.ScalaCompilerSupport.incrementalCompile(ScalaCompilerSupport.java:303)
      at
    scala_maven.ScalaCompilerSupport.compile(ScalaCompilerSupport.java:119)
      at
    scala_maven.ScalaCompilerSupport.doExecute(ScalaCompilerSupport.java:99)
      at scala_maven.ScalaMojoSupport.execute(ScalaMojoSupport.java:482)
      at
    org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo
    (DefaultBuildPluginManager.java:134)</p>
  </blockquote>
  
  <p><code>&lt;build&gt;</code> part of pom.xml file:</p>
  
  <blockquote>
  <pre><code>&lt;build&gt;
      &lt;defaultGoal&gt;package&lt;/defaultGoal&gt;
      &lt;resources&gt;
          &lt;resource&gt;
              &lt;directory&gt;src/main/resources&lt;/directory&gt;
              &lt;filtering&gt;true&lt;/filtering&gt;
          &lt;/resource&gt;
          &lt;resource&gt;
              &lt;directory&gt;src/test/resources&lt;/directory&gt;
              &lt;filtering&gt;true&lt;/filtering&gt;
          &lt;/resource&gt;
      &lt;/resources&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;encoding&gt;${project.build.sourceEncoding}&lt;/encoding&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;copy-resources&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;net.alchim31.maven&lt;/groupId&gt;
              &lt;artifactId&gt;scala-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.2.0&lt;/version&gt;
              &lt;configuration&gt;
          &lt;!--&lt;recompileMode&gt;incremental&lt;/recompileMode&gt;--&gt;
          &lt;args&gt;
              &lt;arg&gt;-target:jvm-1.7&lt;/arg&gt;
          &lt;/args&gt;
          &lt;javacArgs&gt;
              &lt;javacArg&gt;-source&lt;/javacArg&gt;
              &lt;javacArg&gt;1.7&lt;/javacArg&gt;
              &lt;javacArg&gt;-target&lt;/javacArg&gt;
              &lt;javacArg&gt;1.7&lt;/javacArg&gt;
          &lt;/javacArgs&gt;
      &lt;/configuration&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;id&gt;scala-compile&lt;/id&gt;
              &lt;phase&gt;process-resources&lt;/phase&gt;
              &lt;goals&gt;
                  &lt;goal&gt;compile&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
          &lt;execution&gt;
              &lt;id&gt;scala-test-compile&lt;/id&gt;
              &lt;phase&gt;process-test-resources&lt;/phase&gt;
              &lt;goals&gt;
                  &lt;goal&gt;testCompile&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
  &lt;/plugin&gt;
  &lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
      &lt;configuration&gt;
          &lt;source&gt;1.7&lt;/source&gt;
          &lt;target&gt;1.7&lt;/target&gt;
      &lt;/configuration&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;phase&gt;compile&lt;/phase&gt;
              &lt;goals&gt;
                  &lt;goal&gt;compile&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>
    
    <p> 
        
            
                    
                        org.eclipse.m2e
                        lifecycle-mapping
                        1.0.0
                        
                            
                                
                                    
                                        
                                            
                                                net.alchim31.maven
                                            
                                            
                                                scala-maven-plugin
                                            
                                            
                                                [3.1.6,)
                                            
                                            
                                                compile
                                                testCompile
                                            
                                        
                                        
                                            
                                        
                                    
                                
                            
                        
                    
                
            
        </p>
  </blockquote>
  
  <p>Update (dependencies section):</p>
  
  <pre><code>  &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.flume&lt;/groupId&gt;
        &lt;artifactId&gt;flume-ng-sdk&lt;/artifactId&gt;
        &lt;exclusions&gt;
          &lt;!-- Guava is excluded to avoid its use in this module. --&gt;
          &lt;exclusion&gt;
            &lt;groupId&gt;com.google.guava&lt;/groupId&gt;
            &lt;artifactId&gt;guava&lt;/artifactId&gt;
          &lt;/exclusion&gt;
          &lt;!--
            Exclude libthrift since the flume poms seem to confuse sbt, which fails to find the
            dependency.
          --&gt;
          &lt;exclusion&gt;
            &lt;groupId&gt;org.apache.thrift&lt;/groupId&gt;
            &lt;artifactId&gt;libthrift&lt;/artifactId&gt;
          &lt;/exclusion&gt;
        &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.flume&lt;/groupId&gt;
        &lt;artifactId&gt;flume-ng-core&lt;/artifactId&gt;
        &lt;exclusions&gt;
          &lt;exclusion&gt;
            &lt;groupId&gt;com.google.guava&lt;/groupId&gt;
            &lt;artifactId&gt;guava&lt;/artifactId&gt;
          &lt;/exclusion&gt;
          &lt;exclusion&gt;
            &lt;groupId&gt;org.apache.thrift&lt;/groupId&gt;
            &lt;artifactId&gt;libthrift&lt;/artifactId&gt;
          &lt;/exclusion&gt;
        &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.scala-lang&lt;/groupId&gt;
        &lt;artifactId&gt;scala-library&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;!-- Add Guava in test scope since flume actually needs it. --&gt;
        &lt;groupId&gt;com.google.guava&lt;/groupId&gt;
        &lt;artifactId&gt;guava&lt;/artifactId&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;!--
          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" .
        --&gt;
        &lt;groupId&gt;io.netty&lt;/groupId&gt;
        &lt;artifactId&gt;netty&lt;/artifactId&gt;
        &lt;version&gt;3.4.0.Final&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  </code></pre>