Maven with Eclipse

Using Eclipse as Scala IDE with Maven as a build tool is very easy and straightforward. In this section, we will demonstrate with screenshots how to use Scala with Eclipse and Maven. To be able to use Maven in Eclipse, you need to install its plugin, which will be different across different versions of Eclipse. After installing the Maven plugin, you will find that it doesn't support Scala directly. What we need to do in order to get this Maven plugin to support Scala projects is to install a connector called m2eclipse-scala.

If you paste this URL (http://alchim31.free.fr/m2e-scala/update-site ) while trying to add new software to Eclipse, you will find that Eclipse understands the URL and suggests some plugins for you to add:

Figure 4: Installing Maven plugins on Eclipse to enable Maven build

After installing Maven and the connector for Scala support, we are going to create a new Scala Maven project. To create a new Scala Maven project, you need to navigate to New | Project | Other and then choose Maven Project. After this, select the option that has net.alchim31.maven as Group Id:

Figure 5: Creating a Scala Maven project on Eclipse

After this selection, you need to follow the wizard and enter the required values, such as Group Id, and so on. Then, hit Finish and, with this, you have created your first Scala project with Maven support in the workspace. In the project structure, you will find something called pom.xml where you can add all your dependencies and other things.

For more information about how to add dependencies to your project, you can refer to this link at http://docs.scala-lang.org/tutorials/scala-with-maven.html.

As a continuation of this section, we will show you how to build your Spark application written in Scala in the upcoming chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.198.233