More than one scala library found, after update

2,966 views
Skip to first unread message

Muki

unread,
Oct 31, 2011, 12:17:53 PM10/31/11
to Scala IDE User
Hi,

I updated my Eclipse Indigo 3.7.1 to Scala IDE Beta12. Now I got an
error on every Eclipse Plugin project:

"More than one scala library found in the build path. Please update
the project build path so it contains only one scala library
reference"
I opened another Eclipse-Test-Installation (3.7.0), updated Scala IDE,
and created a single Plugin project, added Scala nature and
got the same error. Even after I removed the scala nature, clean-build-
all, the error remains.

I tried to reinstall Scala IDE. Same error.

My system:
Ubuntu 11.04
Oracle Java 7
Eclipse 3.7.x

cheers,
Muki

Muki

unread,
Oct 31, 2011, 2:13:04 PM10/31/11
to Scala IDE User
I was able to "fix" it. This seems to be a problem with the PDE.

I added the Scala-nature, but removed the scala-library from build
path. PDE
adds the scala-library automatically, when you declare import-packages
scala.*.* or
require scala.libary-bundle. The new IDE version doesn't seem to like
the library
twice in the buildpath.

Mirco Dotta

unread,
Nov 1, 2011, 3:59:30 AM11/1/11
to scala-i...@googlegroups.com
Hi Muki,

Yes, we (and when I say we, I mean Luc :)) added a classpath validator which I think will turn out to be 
very useful and avoid some of the common pitfalls one can do when using the Scala IDE.

In a nutshell, the classpath validator checks that in your Scala project contains *exactly one* scala-library, 
and that the library version is in synch with respect to the plugin version you installed (e.g., if you installed 
a plugin for Scala 2.9, then the scala-library in the project should be a 2.9.x library. Note, 2.9.x releases
of Scala are binary compatible).

Here is the related ticket



So the error you were seeing was expected, as having two Scala libraries in the classpath may lead to 
inconsistencies, hence it is better to avoid that altogether.

Cheers,
  Mirco

---------------
Mirco Dotta
Typesafe - Enterprise-Grade Scala from the Experts 
PSE-D, 1015 Lausanne, Switzerland
Twitter: @mircodotta








aborg

unread,
Nov 1, 2011, 11:10:53 AM11/1/11
to scala-i...@googlegroups.com
It seems that the cooperation with the m2e plugin is not so good, maybe because of the different Scala library versions (x.z.zip), but in both cases (x.z.snap.zip uses the 2.9.2-SNAPSHOT scala lib) the scala-ide eclipse plugin complains about:
Description    Resource    Path    Location    Type
More than one scala library found in the build path. Please update the project build path so it contains only one scala library reference    z        Unknown    Scala Problem

I tried removing the Scala Library bundled with the plugin, but in that case:
Description    Resource    Path    Location    Type
Cannot find Scala library on the classpath. Verify your build path!    z        Unknown    Scala Problem

Do you have idea what did I wrong, what is the proposed workaround?
Thanks, gabor

PS.: Windows7 64 bit, Indigo Service Release 1, m2e: 1.0.100.20110804-1717, Scala Plugin: 2.0.0.beta12-2_09-201110310936-87d1fd5
x.z.snap.zip
x.z.zip

Mirco Dotta

unread,
Nov 1, 2011, 11:15:33 AM11/1/11
to scala-i...@googlegroups.com
> It seems that the cooperation with the m2e plugin is not so good, maybe because of the different Scala library versions (x.z.zip), but in both cases (x.z.snap.zip uses the 2.9.2-SNAPSHOT scala lib) the scala-ide eclipse plugin complains about:
> Description Resource Path Location Type
> More than one scala library found in the build path. Please update the project build path so it contains only one scala library reference z Unknown Scala Problem

You need to have only one scala library in the project's classpath, having two of them is ambiguous (how do you know which one is used).

Try to use only Scala Library bundled with the plugin and remove the other one.

If that doesn't fix your issue I can have a look at it during the week.

-- Mirco

aborg

unread,
Nov 1, 2011, 11:58:45 AM11/1/11
to scala-i...@googlegroups.com
On Tuesday, November 1, 2011 4:15:33 PM UTC+1, Mirco Dotta wrote:
You need to have only one scala library in the project's classpath, having two of them is ambiguous (how do you know which one is used).

Try to use only Scala Library bundled with the plugin and remove the other one.

Hi Mirco,

   As I want to handle the dependencies by maven, I cannot remove scala-library from the maven dependencies (one of the other dependencies always puts that on the Maven Dependencies classpath container anyway). So I guess the only option would be an eclipse plugin for m2e to handle scala propects properly. (I am not sure why the check for the scala lib not successful for scala ide, if the Maven Dependencies container already provides it.)
Thanks, gabor

Mirco Dotta

unread,
Nov 1, 2011, 12:18:47 PM11/1/11
to scala-i...@googlegroups.com
> As I want to handle the dependencies by maven, I cannot remove scala-library from the maven dependencies (one of the other dependencies always puts that on the Maven Dependencies classpath container anyway). So I guess the only option would be an eclipse plugin for m2e to handle scala propects properly. (I am not sure why the check for the scala lib not successful for scala ide, if the Maven Dependencies container already provides it.)

Yep, I didn't think of that. Luc (Bourlier) looked at your issue and he's actually writing up a short wiki page on how to use Maven with the Scala IDE.

I think you will have an answer very soon ;)

-- Mirco

Luc Bourlier

unread,
Nov 1, 2011, 12:19:00 PM11/1/11
to scala-i...@googlegroups.com
You are right. And such a plug-in exists, it is called m2eclipse-scala and is available at https://github.com/sonatype/m2eclipse-scala.

Cheers,
Luc

Luc Bourlier

unread,
Nov 1, 2011, 12:22:14 PM11/1/11
to scala-i...@googlegroups.com
Hi Muki,

removing the scala-library from the build path is the right solution in this case.

The 'add scala nature' should not add the extra one. I created a ticket for this problem: https://www.assembla.com/spaces/scala-ide/tickets/1000713

Cheers,
Luc

Trevor Hartman

unread,
Nov 1, 2011, 5:00:50 PM11/1/11
to scala-i...@googlegroups.com
I have the same issue after upgrade. 

I tried removing the Scala Library from my build path, but then eclipse complains: "Cannot find Scala library on the classpath. Verify your build path!" If I add it back in, it once again says: "More than one scala library found in the build path. Please update the project build path so it contains only one scala library reference". 

Mirco Dotta

unread,
Nov 1, 2011, 6:26:45 PM11/1/11
to scala-i...@googlegroups.com
As Luc pointed out, if you use the M2Eclipse-Scala plugin then everything should work as expected (make sure to add the Scala Library bundled with the plugin in the build path).

Please, give it a try and let us know if that doesn't work.

-- Mirco

aborg

unread,
Nov 2, 2011, 9:12:05 AM11/2/11
to scala-i...@googlegroups.com
Thank you Luc, it works really well. Although the pages are a bit misleading (http://www.assembla.com/wiki/show/scala-ide/With_M2Eclipse, https://github.com/sonatype/m2eclipse-scala), as the latest version (0.3.1) is not available through download, but through this update site: http://alchim31.free.fr/m2e-scala/update-site/
I had problems installing the 0.2.3 version to the dropins folder, maybe some of the dependencies were not yet installed, but from the update site, it installed easily.

Alex Black

unread,
Nov 4, 2011, 9:39:43 AM11/4/11
to Scala IDE User
Hi Mirco, I'm having this problem too, after upgrading from beta 10 to
beta 11, I'm using m2eclipse and m2eclipse-scala. I'm not sure how to
fix the problem.

I looked at 'java build path' under project properties, and under
libraries I see just one scala library (2.9.2.r25900-....).

thx

- Alex

Alex Black

unread,
Nov 4, 2011, 9:41:05 AM11/4/11
to Scala IDE User
oops, I meant "after upgrading from beta 10 to beta 12"

Mirco Dotta

unread,
Nov 4, 2011, 10:50:50 AM11/4/11
to scala-i...@googlegroups.com
Hi Alex,

Unfortunately, the current implementation of the Classpath Validator does not play nicely with Maven,
even when using m2eclipse-scala.

Very useful feedback has been provided by Matthew Farwell and we will for sure work for fixing it.

https://groups.google.com/group/scala-ide-dev/browse_thread/thread/6ea6c7677560fb91?hl=en

I think what he explains is exactly what you are experiencing. I'd suggest you to have a look at it, I'm sure
you will find yourself nodding :)

At the moment, my suggestion would be to either

1) Modify your POM and exclude the dependencies to the scala library (I know, less than optimal, but if
you can manage to have only the bundled Scala Library in the classpath, then everything should work
just as expected and you will take full advantage of beta-12).

2) Downgrade to beta11 and wait for the new release. Here is the update site for beta11-29
http://download.scala-ide.org/builds/beta-29-2.0.0/beta11/


Hope this helps.

Cheers,
Mirco

Alex Black

unread,
Nov 4, 2011, 10:51:47 AM11/4/11
to Scala IDE User
I've managed to fix my problem, I think perhaps it was caused by the
fact that I wasn't using the latest version of m2eclipse. I think I
was using 0.12.1.20110112-1712

So, I uninstalled m2eclipse-scala, then uninstalled m2ecplise, then
installed the latest m2eclipse-scala (which caused m2eclipse to be
installed), now the error has disappeared.

Mirco Dotta

unread,
Nov 4, 2011, 10:52:58 AM11/4/11
to scala-i...@googlegroups.com
Oh, that is even better then!

Happy coding! :))

-- Mirco

Alex Black

unread,
Nov 4, 2011, 10:54:10 AM11/4/11
to Scala IDE User
Hi Mirco, thanks for the detailed info.. I seem to have things up and
running with Beta 12, so I'm happy now.

(fyi, modifying the POM file is really not an option, I can't see my
collegues (the ones not using Eclipse) or my build server being able
to compile if scala is not in the POM file :)



On Nov 4, 10:50 am, Mirco Dotta <mirco.do...@typesafe.com> wrote:
> Hi Alex,
>
> Unfortunately, the current implementation of the Classpath Validator does not play nicely with Maven,
> even when using m2eclipse-scala.
>
> Very useful feedback has been provided by Matthew Farwell and we will for sure work for fixing it.
>
>        https://groups.google.com/group/scala-ide-dev/browse_thread/thread/6e...
>
> I think what he explains is exactly what you are experiencing. I'd suggest you to have a look at it, I'm sure
> you will find yourself nodding :)
>
> At the moment, my suggestion would be to either
>
> 1) Modify your POM and exclude the dependencies to the scala library (I know, less than optimal, but if
> you can manage to have only the bundled Scala Library in the classpath, then everything should work
> just as expected and you will take full advantage of beta-12).
>
> 2) Downgrade to beta11 and wait for the new release. Here is the update site for beta11-29http://download.scala-ide.org/builds/beta-29-2.0.0/beta11/

Mirco Dotta

unread,
Nov 4, 2011, 11:00:45 AM11/4/11
to scala-i...@googlegroups.com
> Hi Mirco, thanks for the detailed info.. I seem to have things up and
> running with Beta 12, so I'm happy now.

Sweet.

>
> (fyi, modifying the POM file is really not an option, I can't see my
> collegues (the ones not using Eclipse) or my build server being able
> to compile if scala is not in the POM file :)

Yeah, I can definitely see that. I was simply giving the available options, as
I didn't see a truly best one (downgrading is also a shame, as beta12 has
improved in many ways - at least I hope so ;))


Cheers,
Mirco

merlin-hst

unread,
Nov 4, 2011, 3:08:29 PM11/4/11
to scala-i...@googlegroups.com

I'm having the same "problem" but can't use the m2eclipse-scala plugin. I'm using maven for dependency management and deployment but I'm using not the M2Eclipse plugin because is isn't compatible with the eclipse WTP plugin. And the sysdeo plugin on the other hand isn't really compatible with M2Eclipse ;) At least it is very uncomfortable (http://tech-nickel.blogspot.com/2008/10/eclipse-tomcat-sysdeo-and-devloader.html). I haven't tried the maven sysdeo plugin (http://mojo.codehaus.org/sysdeo-tomcat-maven-plugin/index.html) but it seems to be very old. So for now I'm using the maven eclipse plugin (http://maven.apache.org/plugins/maven-eclipse-plugin/) to automatically create the classpath and project files as described here (http://scala-tools.org/mvnsites-snapshots/maven-scala-plugin/faq.html).That means I can't make any changes to that files. And because maven needs the scala dependencies for compiling the scala sources the scala library is also included in the generated classpath file. So without the M2Eclipse plugin I can't use the m2eclipse-scala plugin ;) Now I can't remove the scala library from the classpath and also not from the plugin ...

From my point of view there are some (theoretical) solutions to that :

1.) Let the plugin use the version from the classpath if available otherwise use the bundled version.
2.) Let the user choose the version to use like the JDK version
3.) Make the classpath validator more sophisticated (*)
4.) Let the user turn off the error message ;)

* For example if more than 1 only scala lib is found and the version "is the same" - ok if the version is not "the same" - error. The same means if all libraries uses 2.8.X or all libraries uses 2.9.X - no error; if 2.8 and 2.9 are mixed diplay the error.   

Sorry for the long story ;) But I really would like to use eclipse, maven and scala but without the M2Eclipse and m2eclipse-scala plugin.

Lothar

merlin-hst

unread,
Nov 4, 2011, 3:27:25 PM11/4/11
to scala-i...@googlegroups.com
I' ve just read the options suggested by Matthew here https://groups.google.com/forum/?hl=en#!topic/scala-ide-dev/bqbHZ3Vg-5E, so sorry for the redundant post, 

But of course it would be *really* usefull to apply one of these ;)

Lothar 

Sarah Gerweck

unread,
Nov 6, 2011, 4:44:54 AM11/6/11
to Scala IDE User
Here's hoping for a quick fix for this one. I think you should
consider putting out a b13 (or 12.1) as quickly as possible just for
this issue.

The Maven-Scala plugin didn't work for me (and honestly I don't really
trust something like that to keep it in my environment) so I'm going
to be downgrading.

In general I think there should probably be a way to disable these
checks: You're going to run into exactly the same thing from people
who use the Ivy plugin. You shouldn't hold someone's whole project
hostage just because you think their environment isn't exactly
perfect.

Anyway keep up the work and I'll hold my breath for a fix.

Mirco Dotta

unread,
Nov 6, 2011, 6:04:32 AM11/6/11
to scala-i...@googlegroups.com
Hi Sarah,

Yes, we are aware that the classpath validator did cause troubles to Maven users and we
are already working on a solution. Hopefully, we will have some more news on Monday/Tuesday.

-- Mirco

schmmd

unread,
Nov 8, 2011, 5:30:14 PM11/8/11
to Scala IDE User
Another option is to use the maven eclipse plugin "mvn
eclipse:eclipse". Not a very good long-term solution though! I
couldn't get any of the other "solutions" to work.

hlascelles

unread,
Nov 9, 2011, 8:48:14 AM11/9/11
to Scala IDE User
I'm seeing the same thing when Eclipse files are generated by Buildr.
Scala IDE appears to get stuck in a rut when it (quite rightly) spots
two scala libraries. But it then won't clear itself of the problem
after one (or even both) of those libraries are removed. Closing the
project/cleaning/rebuilding has no effect.

Deleting the project entirely, then reimporting it fixed the issue...
or now.

I'm using the 2.0.0 beta. Looking forward to the future fix, cheers!

H
Reply all
Reply to author
Forward
0 new messages