How do I generate a scala compiler plugin as part of the build process and use it to build subsequent projects?

I have an IDEA module that contains 2 projects. The first project is a Scala compiler plugin, the second is another project that requires the mentioned Scala plugin during the build phase. Scala plugin project contains build.xml Ant file with tasks build

and clean

(used to generate jar file). A typical project depends on a Scala plugin project. When I build the whole module, IntelliJ does the following tasks:

  • build Scala compiler plugin project
  • run Ant tasks ( clean

    and then build

    ) to generate Scala plugin compiler jar
  • build a second project

And it fails at cool 3 because it doesn't see the Scala plugin jar. The error I see looks like this: Warning: could not load descriptor for plugin Path_to_existing_plugin_jar_file"

This message comes from here: http://lampsvn.epfl.ch/svn-repos/scala/scala-experimental/trunk/bootstrap/src/compiler/scala/tools/nsc/plugins/ Plugin.scala

I have checked the paths several times, they are ok. And the jar file exists on the hard drive.
If I disable the clean

Ant task and try to build the module twice, it works fine (first time it fails with exactly the same error message).

To me it looks like IntelliJ / scalac is trying to load this Scala compiler plugin at the beginning of the build unit, and even if it exists later, this fact is ignored.

Is there a way to fix this behavior? For some reason I would like to build both projects in one pass.

+3


source to share





All Articles