Package contains object and package with same name compiler error - builds with scalac
I am having problems compiling some Scala with Eclipse where I try to import a class from a Java jar which contains both a namespace and class of the same name. I can compile with scalac, however.
e.g. the Java project (jar) contains:
Scala project references foobar.jar
Foobartest.scala:
Compiler complains with:
package foo contains object and package with same name: bar one of them needs to be removed from classpath
I can build this class with scalac, but not with Eclipse (or Maven!). I first saw this problem using jenkins-core-1.399.jar
Using Scala IDE for Eclipse 2.0.0.rc02-2_09-201111231928-a89c4
e.g. the Java project (jar) contains:
src/foo/Bar.java
src/foo/Bar/some_resource.txt
Scala project references foobar.jar
Foobartest.scala:
import foo.Bar
class Foobartest { }
Compiler complains with:
package foo contains object and package with same name: bar one of them needs to be removed from classpath
I can build this class with scalac, but not with Eclipse (or Maven!). I first saw this problem using jenkins-core-1.399.jar
Using Scala IDE for Eclipse 2.0.0.rc02-2_09-201111231928-a89c4
Leave a comment
on 2012-05-07 12:39 *
By Mirco Dotta
Assigned to set to skyluc
Milestone set to 2.0.x
Priority changed from Normal (3) to Highest (1)
The same problem is visible with scalac on the command line.
The good news is, it has been 'fixed': SI-2089.
Add
In eclipse, add it to
The good news is, it has been 'fixed': SI-2089.
Add
-Yresolve-term-conflict:object
as a compiler option to get it to compile (and get a warning).In eclipse, add it to
Additional command line parameters
, in the scala/compiler
section of your project preferences or the general preferences.