I am trying to run some trivial Scala code in Eclipse but I am not able to get it working when Maven is enabled.
I start by creating a Scala project in Eclipse and then I add an object with the following code:
object HelloSpark extends App
{
println("Hello, world!")
}
I then use "Run As>>Scala Application" to successfully execute the above code:
Hello, world!
I then enable Maven by clicking on "Configure>>Convert to Maven Project". While the ensuing build is successful, the "Run As>>Scala Application" option no longer comes up. Using the previously created launch configuration results in the following error:
Error: Could not find or load main class HelloSpark
Trying the answer for Eclipse, Scala & Maven - Class files are not generating did not help in my case.
Could someone please tell me what I am doing wrong? I don't understand why enabling Maven changes the way Scala code is run.
Thanks.
Edit: Here is the pom.xml that was automatically generated when I converted the above to a Maven project:
<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>HelloSpark</groupId>
<artifactId>HelloSpark</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>