Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scala package conflict

Tags:

scala

I have a library which has root package "scala", and now I have a project using this library, and I have a sub package named "com.zjffdu.scala". And the class file in this package needs to import classes from the library. So I have the following import statement.

import scala._

But because this class is also in package "scala", the scala compiler will look for files in current directory rather than the library.

So how can I explicit to tell scala to import classes from the library.

Thanks

like image 981
zjffdu Avatar asked Jun 08 '11 07:06

zjffdu


1 Answers

Use this:

import _root_.scala._

As you can see it's not very pretty — the best option is probably to avoid naming one of your packages scala.

And by the way — the root scala package is always preimported (though subpackages, of course, are not).

like image 159
Jean-Philippe Pellet Avatar answered Sep 30 '22 17:09

Jean-Philippe Pellet