eclipsescalamavenscala-idemaven-scala-plugin

Scala-Maven project on Eclipse


I am trying to use this Scala project.

The project contains maven dependencies so I have created a pom.xml and then I have imported the project as a maven project in eclipse.

In order to test the project I tried to add a Scala class, but I'm surprised that I can't.

this is my pom.xml :

<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>

<groupId>com.group-name</groupId>
<artifactId>my-project</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<dependencies>

    <dependency>
        <groupId>org.scala-lang</groupId>
        <artifactId>scala-compiler</artifactId>
        <version>2.12.6</version>
    </dependency>

<dependency>
  <groupId>org.opencypher</groupId>
  <artifactId>spark-cypher</artifactId>
  <version>0.1.5</version>
</dependency>

</dependencies>
</project>

i imported it to eclipse as a maven project then i build the maven project.

My questions are:

1) is my approach right ?

2) if 1) is right then how can I use this Scala project with maven ??


Solution

  • In order to import a Scala Maven Project on eclipse, you need to :

    • install Scala plugin for eclipse (HELP>ECLIPS MARKETPLACE>”search for Scala ide”)

    • Install Maven Integration for Scala IDE(HELP>INSTALL NEW SOFTWARE>”search for http://alchim31.free.fr/m2e-scala/update-site/”)

    • Import project as Existing Maven Projects