Problems getting mixed Java/Scala projects to build.

Hello,

I'm considering switching our development organization over to Idea for since we've begun to integrate some scala into our project.  So far, I like most of what I've seen with the scala plugin but I've run into a fatal flaw that I can't seem to find a way around.

Our project is composed of several modules, each with src and tests, java and scala code.  In order to get the project to build, scalac needs to be run first since we've got some bi-directional java/scala associations going on.  However, this causes a "scalac internal error" and the build fails (see below).

Information:Compilation completed with 11 errors and 0 warnings
Information:11 errors
Information:0 warnings
Error:Scalac internal error: class java.lang.ClassNotFoundException [java.net.URLClassLoader$1.run(URLClassLoader.java:200), java.security.AccessController.doPrivileged(Native Method), java.net.URLClassLoader.findClass(URLClassLoader.java:188), java.lang.ClassLoader.loadClass(ClassLoader.java:316), sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280), java.lang.ClassLoader.loadClass(ClassLoader.java:251), java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374), java.lang.Class.forName0(Native Method), java.lang.Class.forName(Class.java:164), org.jetbrains.plugins.scala.compiler.rt.ScalacRunner.main(ScalacRunner.java:73)]
Error:java.net.URLClassLoader$1.run(URLClassLoader.java:200)
(...)
Error:java.lang.Class.forName(Class.java:164)
Error:org.jetbrains.plugins.scala.compiler.rt.ScalacRunner.main(ScalacRunner.java:73)


My co-workers and I have tried mangling the project build settings in a number of different ways to no luck.  The most promising work around was mentioned in http://www.jetbrains.net/jira/browse/SCL-500 but even setting the output directories to be the same didn't help us out.

Has anybody been able to get a project with this sort of structure to work?  If so, what am I missing?

Thanks

8 comments
Comment actions Permalink

i am using maven+scala tools and it's working with mixed java/scala projects.

HTH

0
Comment actions Permalink

I forgot to mention that the equivalent projects build just fine in ant using:

<scalac .....>
<javac ....>

...and building using Eclipse's scala plugin also works fine.

It's only Idea that is having this problem.

0
Comment actions Permalink

Hello, Michael.

It's very hard to figure out a real cause of this exception. Could you attach a little test project to help us reproduce it?
Thanks.

With best reagrds,
Ilya

0
Comment actions Permalink

BTW, full rebuild of project (Build -> rebuild project) might help.

With best regards,
Ilya

0
Comment actions Permalink

Full rebuild did not work.  All of the build commands in the menu cause the same error.

We're working on putting together a small test project which reproduces this problem.

0
Comment actions Permalink

Attached is a project which causes the 'scalac internal error'.  We've discovered several useful bits of information.

First of all, the attached project has no scala facet and no scala code, but the error still occurs.  Adding a scala facet makes this project compile.  Using this information, further investigation revealed that by adding the Scala Facet to ALL of our modules (including the the modules which do not have any scala code) makes the "scalac internal error" go away.



Attachment(s):
breakme.zip
0
Comment actions Permalink

Hello, Michael.

Thanks you for helpful example. We fixed this problem. and updated plugin version may be download now from our repository. Notice, that because of major API changes it works only with last IDEA EAP (http://jetbrains.net/confluence/display/IDEADEV/Diana+EAP).
Sorry for inconvenience.

With best regards,
Ilya

0
Comment actions Permalink

Thank you!  I'll give the EAP a try.

0

Please sign in to leave a comment.