Scala source files not recognized by the compiler in Eclipse

I am working on a playframework project that I eclipsed from the console and opened from Eclipse.

However, my scala source files are treated like java source files using Eclipse with resulting compilation errors.

Can anybody help?

EDIT: Mine. project:

<projectDescription>
  <name>web</name>
  <buildSpec>
    <buildCommand>
      <name>org.scala-ide.sdt.core.scalabuilder</name>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>org.scala-ide.sdt.core.scalanature</nature>
    <nature>org.eclipse.jdt.core.javanature</nature>
  </natures>
</projectDescription>
+5
source share
4 answers

I have had similar problems in the past. I think the problem was in Java Builder for the project. This is the contents of a file .projectthat classes can create Javaas well Scala. You can compare it with your own configuration:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>debug-s</name>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.scala-ide.sdt.core.scalabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.scala-ide.sdt.core.scalanature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>
+5
source

Scala -ide - Helios, Indigo - . Scala Nature . , Configure->Add Scala Nature , .

+4

, TWICE, , ( ). Maven Eclipse eclipse:eclipse ( ), .classpath .scala . .classpath ( ) . Eclipse, , , Java Scala .project, , ... . .

, , , .., Scala . . "hmmm" .scala. "" , .?!?!?

TL; DR, , .scala , ,

+2

. Eclipse 4.3 (Kepler)
Scala IDE Eclipse 3.0.1.v-2_10-201307101641-eff8147. maven scala, . , java-, . , . , scala . ( Eclipse) .

scala Eclipse. .classpath src - et voila! . eclipse, maven.

ETA: .project, maven. :   <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> </buildCommand>

And when I understood, the problem disappeared. I also had another problem:   <comment>myproject. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>

This is probably why javabuilder first appeared. I had to add to scalabuilder by adding scala Nature to my project. Perhaps this problem does not appear, I will add the M2Eclipse plugin. I will try and take a look.

0
source

All Articles