Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysterious Scala + Eclipse compilation errors

Tags:

eclipse

scala

I'm writing a mixed Scala and Java program using Eclipse. Everything was working fine until about an hour ago, when it all went to hell for no apparent reason.

There are no problems (Scala or Java) reported in Eclipse, but the Scala builder appears to be failing somewhere. It is no longer producing any class files. Attempting to run "Hello World" in Scala now results in the message:

Project 'projectname' contains compilation errors (therefore, no binaries have been produced)

I'm using default settings for the Scala builder, and it worked fine earlier. I haven't changed anything.

I've tried cleaning and rebuilding the project several times, to no avail. The build progress dialog gives the appearance that both Scala and Java builds are successful. Pure-Java parts of the program compile and execute successfully. (I've temporarily commented out places where Java calls through to Scala, because the lack of Scala class files was causing 'unresolved class' import error)

Is there a Scala compiler error log somewhere that will tell me what is going wrong?? I am about to start tearing my hair out.

I don't remember exactly what I did that caused this, but it wouldn't have been anything exotic: writing a few new classes, some basic refactoring, etc.

like image 860
ljp Avatar asked Nov 12 '22 07:11

ljp


1 Answers

First look on Eclipse console output during build. You can see lot of interesting things :-).

Just one possible direction to look into:

I'm not 100% sure but AFAIR Eclipse use Maven to build Java and Scala sources (at least on projects I received). If you see pom.xml file in project root, that is it and you can try to issue commands like mvn compile and check logs. With Maven there could be lot of issues starting from ones in local JAR repository.

BTW Maven repository is located in ~/.m2. Of course most of this corresponds to Unix installations.

like image 181
Roman Nikitchenko Avatar answered Nov 15 '22 07:11

Roman Nikitchenko