Or how to use maven-eclipse-plugin which emits Eclipse metadata
Assumes:
Provides:
pom.xml (use instruction from maven-scala-plugin and complete with pom.xml fragment from below)mvn eclipse:clean eclipse:eclipse to update eclipse meta-dataWindow > Preferences > Java > Build Path > Classpath Variable to point to your $HOME/.m2/repository directorymvn -Declipse.workspace=<path to workspace> eclipse:configure-workspace ( See eclipse:configure-workspace ) to add it automatically.pom.xmlmvn eclipse:clean eclipse:eclipse to update eclipse meta-data <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<!-- see http://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html for more information -->
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<projectnatures>
<projectnature>org.scala-ide.sdt.core.scalanature</projectnature>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
</projectnatures>
<buildcommands>
<buildcommand>org.scala-ide.sdt.core.scalabuilder</buildcommand>
</buildcommands>
<classpathContainers>
<classpathContainer>org.scala-ide.sdt.launching.SCALA_CONTAINER"</classpathContainer>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
</classpathContainers>
<excludes>
<exclude>org.scala-lang:scala-library</exclude>
<exclude>org.scala-lang:scala-compiler</exclude>
</excludes>
<sourceIncludes>
<sourceInclude>**/*.scala</sourceInclude>
<sourceInclude>**/*.java</sourceInclude>
</sourceIncludes>
</configuration>
</plugin>
For more configuration options or information take a look at the site of maven-eclipse-plugin
If you have a Scala only project, you need to configure sourceDirectory and testSourceDirectory as is ( required by maven-eclipse-plugin not by maven-scala-plugin ) :
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
...
For more configuration options or information take a look at the site of maven POM Overview (Technical Project Descriptor)
If you have a mixed Java/Scala project with code into separated root directory (like src/(main|test)/scala and src/(main|test)/java) :
<!-- Adds src/main/scala and src/test/scala as source folders, from http://groups.google.com/group/liftweb/browse_thread/thread/3dac7002f9e59546/3918bba2f7a92cd3?pli=1 -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/scala</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/scala</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
For more configuration options or information take a look at the site of build-helper-maven-plugin.
For configuration of the compilation under maven see doc of maven-scala-plugin :
process-resources