Pages

Sunday, May 29, 2011

Your first Scala module with Maven

Start by:

  • Installing IntelliJ IDEA
  • Downloading and unpacking Maven
  • Installing Scala
  • Installing Scala plugin to IntelliJ
  • Setting Maven home directory (either with M2_HOME or overriding the settings in IntelliJ)
Next up is creating a project and a module based on scala-archetype-simple:


File -> New project..
Select "Create project from scratch".

Give the project a name and the module a name. Remember that the module name is used as a package name for scala, so no dashes allowed!

Select module type: Maven Module.

Click next.

Make sure the create from archetype is selected and click "Add Archetype..".

Fill in the following details:


Select the archetype you added and click Finish.

In this archetype, the pom.xml contains <repositories> and <pluginRepositories> but they are commented out. Uncomment those blocks.

On the very right side of IntelliJ there's a vertical block that contains a tab called Maven Projects. Open it, open the project you just created and run the "package" maven task. This will compile, test and package your project and it will also download all dependencies required by a scala maven project.

Now you should be all set to create your first maven-based scala project.

Note that the archetype used, also created a simple object for you and some tests for that object to get you started.

No comments:

Post a Comment