title: maven project which has both java and scala
body: <p>I want to build a maven project which has both java and scala source code.
  I have installed scala IDE plugin in eclipse and added the <strong>"scala-maven-plugin"</strong>  in pom.xml but the imports of java classes in the scala files are giving compilation errors.
  Which is the best IDE to build such mixed projects?</p>
  
  <p>The project structure is </p>
  
  <p><a href="https://i.stack.imgur.com/sliqh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sliqh.png" alt="enter image description here"></a></p>
  
  <p>The pom.xml </p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;org.apache.spark&lt;/groupId&gt;
    &lt;artifactId&gt;spark-examples_2.11&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.scala-lang&lt;/groupId&gt;
          &lt;artifactId&gt;scala-library&lt;/artifactId&gt;
          &lt;version&gt;2.11.7&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;build&gt;
  &lt;pluginManagement&gt;
      &lt;plugins&gt;
  &lt;!-- This plugin compiles Scala files --&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;net.alchim31.maven&lt;/groupId&gt;
              &lt;artifactId&gt;scala-maven-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;scala-compile-first&lt;/id&gt;
                      &lt;phase&gt;process-resources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;add-source&lt;/goal&gt;
                          &lt;goal&gt;compile&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  &lt;!-- This plugin compiles Java files --&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.8&lt;/source&gt;
                  &lt;target&gt;1.8&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;
  &lt;!-- This plugin adds all dependencies to JAR file during 'package' command.
  Pay EXTRA attention to the 'mainClass' tag. 
  You have to set name of class with entry point to program ('main' method) --&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.5.3&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;descriptorRefs&gt;
                      &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                  &lt;/descriptorRefs&gt;
                  &lt;archive&gt;
                      &lt;manifest&gt;
                          &lt;mainClass&gt;ScalaRunner&lt;/mainClass&gt;
                      &lt;/manifest&gt;
                  &lt;/archive&gt;
              &lt;/configuration&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;single&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/pluginManagement&gt;  
  &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>