Problems with multiple scala libraries in a project

271 views
Skip to first unread message

James Moore

unread,
Jun 12, 2012, 9:48:01 AM6/12/12
to scala-ide-user
I got a bug report on the Android Scala plugin saying that the presentation compiler was crashing when the plugin is installed.

One of the things that happens is that you end up with two scala libraries in a project.  The normal scala library, and that same library after running proguard on it.  The second is much smaller, of course, and it looks like the IDE is actually trying to use it and failing.  I'm seeing errors like:

Presentation compiler crashed while type checking this file: scala.tools.nsc.FatalError: object List does not have a member apply

And I do see this warning message:

  More than one scala library found in the build path, all with compatible versions. This is not an optimal configuration, try to limit to one scala library in the build path.

(But more than one in the build path I think is a hard requirement for Android)

Removing the minified library makes the presentation compiler crash go away.  But it means that you can't build the Android project.

Whether or not the minified library is on the classpath doesn't seem to matter.

Is there a way to tell the IDE that there must be two different scala libraries in the project, and the IDE should only use the one that it added (the Scala classpath container)?

-- 

James Moore
ja...@restphone.com
http://blog.restphone.com/
http://www.linkedin.com/in/jamesmmooreiv

iulian dragos

unread,
Jun 12, 2012, 10:31:44 AM6/12/12
to scala-i...@googlegroups.com
In short, no. The plugin will pick up the first Scala library in the build path order. Would it work to move the minimized library later in the build path?

iulian



--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais

James Moore

unread,
Jun 12, 2012, 11:07:15 AM6/12/12
to scala-i...@googlegroups.com
On Tue, Jun 12, 2012 at 7:31 AM, iulian dragos <jagu...@gmail.com> wrote:

Is there a way to tell the IDE that there must be two different scala libraries in the project, and the IDE should only use the one that it added (the Scala classpath container)?


In short, no. The plugin will pick up the first Scala library in the build path order. Would it work to move the minimized library later in the build path?

Yes, I just tried editing the classpath by hand to change the order to:

        <classpathentry kind="src" path="src"/>
        <classpathentry kind="src" path="gen"/>
        <classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
        <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
        ....

and that seems to solve the problem.

In my plugin, I'll move org.scala-ide.sdt.launching.SCALA_CONTAINER to be early in the classpath.

It might make sense for the IDE to install it early in the classpath by default, instead of adding it on to the end.

Reply all
Reply to author
Forward
0 new messages