My favorites | Sign in
Project Home Wiki Issues Source
Search
for
CreatingScalaMavenProjectsInEclipse  
How to Create a Scala + Maven Project in Eclipse
scala, maven, eclipse
Updated Feb 4, 2010 by Joshua.S...@gmail.com

Introduction

There are several different methods for using Scala + Maven with Eclipse.

Existing Java/Maven Project

If you have an existing java/maven project, you must do three things:

  1. Install the scala eclipse plugin
  2. Right click on the project. Go to the Scala Menu and select "Add Scala Nature"
  3. Update your pom.xml to use the maven-scala-plugin and depend on the scala-library like in the pom shown below.
  4. <project>
    ...
      <dependencies>
        <dependency>
          <groupId>org.scala-lang</groupId>
          <artifactId>scala-library</artifactId>
          <version>2.7.2</version>
        </dependency>
        ...
      </dependencies>
      ...
      <build>
        ...
        <plugins>
          ...
          <plugin>
            <groupId>org.scala-tools</groupId>
            <artifactId>maven-scala-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>add-source</goal>
                  <goal>compile</goal>
                  <goal>testCompile</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          ...
        </plugins>
      </build>
      ...
    </project>
Comment by philipmu...@gmail.com, Mar 3, 2011

correction/update: 2. Right click on the project. Pick Configure. Select "Add Scala Nature"

Comment by ernest.m...@gmail.com, Dec 7, 2011

"Add Scala Nature" is only available after selecting the Scala Perspective


Sign in to add a comment
Powered by Google Project Hosting