IDEA provides an Ant task, javac2, that does this. This is a replacement for the standard javac Ant task.
First, you need to include something like the following at the top of your Ant build file.
<path id="javac2.class.path"> <pathelement location="${idea.dir}/redist/forms_rt.jar"/> <pathelement location="${idea.dir}/redist/javac2.jar"/> <pathelement location="${idea.dir}/redist/annotations.jar"/> </path> <taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.class.path"/>
Here "$ {idea.dir}" refers to the directory of your IDEA installation. These banks can be redistributed, so you can copy them to your project, if you want, and refer to them. After you have done this, simply replace any calls with "javac" with "javac2" and everything should work.
To compile scala, of course, you will need calls in either scalac or fsc, but all of this is not affected.
Dave griffith
source share