Difference between Dependencies Scala compiler/lib and Scala Facet compiler/lib

Hi.

I'm not sure I understand why there's a need to specify scala compiler/library jars in both the Facet Scala section and in the Dependences tab of the project.

What is each one used for?

Thanks, Nick.

6 comments
Comment actions Permalink

You should prefer including the compiler and library jars as module dependencies. Specifying them in the facet configuration is aimed towards people developing the Scala compiler itself using IntelliJ.

-jason

0
Comment actions Permalink

Thanks for the response Jason.

Does that mean that if I want to switch between projects using scala 2.7 and those using 2.8, I only have to change the compiler and library jars in the module dependencies and I can ignore the ones in the Facet tab?

0
Comment actions Permalink

Yes, provided that 'Use Scala compiler from ...' is unchecked in the Facet configuration.

When using the plugin to edit 2.7 sources, it helps to make them 2.8 forwards compatible with respect to packaging and imports, as below.

== 2.7 Sources ==

-- com/acme/Gadget.scala
package com.acme
class Gadget

-- com/acme/wizbang/Gadget.scala
package com.acme.wizbang

class NewGadget extends Gadget


== 2.8 Translation, (will not compile with 2.7!) ==

-- com/acme/Gadget.scala
package com.acme
class Gadget

-- com/acme/wizbang/Gadget.scala
package com.acme
package wizbang

class NewGadget extends Gadget


== 2.7 / 2.8 Compatible ==

-- com/acme/Gadget.scala
package com.acme
class Gadget

-- com/acme/wizbang/Gadget.scala
package com.acme.wizbang  // new in 2.8 'unnested packages', to avoid accidental namespace conflicts.
import com.acme._               // so we have to import the parent packages we care about.

class NewGadget extends Gadget

0
Comment actions Permalink

Facet page - it's compiler, which you use for compilation. This jars will not be added to compilation classpath, or to runtime. So you need to set up it as dependency.set up  It's a difference.
If you don't use Scala 2.8 Nightly Builds you need to setup Facet page. Otherwise, bundled Scala 2.8 compiler will be used for compilation.

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

Hi Alexander.

Reading this post:

http://www.jetbrains.net/devnet/message/5259532#5259532

got me thinking about this again.

I don't understand why IDEA doesn't allow you to specify a "Scala SDK" in the same way you can specify a JDK. Then, whenever you add a scala facet to a module, you can specify the scala SDK to use. Then you know which compiler is being used, and you who that the compiler is compatible with the compiler jar and library jar that are put on the compile and runtime classpath.

I'm sure there is a good reason for not doing it this way so can you please put my mind at rest and tell me?

Just so you know, I'm not having any problems at the moment.

Thanks, Nick.

0
Comment actions Permalink

We definitely have usability problems in this place. I can't promise this will be fixed soon, but it will be.

Best regards,
Alexander Podkhalyuzin.

0

Please sign in to leave a comment.