Javac2 ant task documentation, or help?
I've started usign IDEA 4.0's UI Designer, and find it helpful. However, like many people, I prefer to have my build process separate from my IDE. I've found a few pre-4.0-release postings discussing the '' Ant task that is supposed to be a drop-in replacement for '' in order to handle the UI Designer's .form XML files, which seems like a perfect fit. However, I can't find any documentation, or get it working.
I initially tried just including $IDEA_HOME/redist/javac2.jar in my compilation classpath, which gave me the following error:
$ ant compile
Buildfile: build.xml
prepare:
compile:
BUILD FAILED
java.lang.NoClassDefFoundError
at com.intellij.util.BcelUtils$1.class$(Unknown Source)
at com.intellij.util.BcelUtils.disposeBcel(Unknown Source)
at com.intellij.uiDesigner.ant.Javac2.compile(Unknown Source)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
...
at org.apache.tools.ant.Main.main(Main.java:235)
Caused by: java.lang.ClassNotFoundException: org.apache.bcel.util.SyntheticRepository
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1075)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1036)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:925)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
... 12 more
So, following someone else's forum post, I started including other jarfiles as well (bcel.jar, idea.jar, etc etc). I quickly tired of the guess & check, and just included every jarfile from the IDEA 4.0 release into the classpath. Crude, I know, but what the heck. That produces a RuntimeException, as shown here:
$ ant compile
Buildfile: build.xml
prepare:
compile:
BUILD FAILED
java.lang.RuntimeException: java.lang.NoSuchFieldException: _repository
at com.intellij.util.BcelUtils.disposeBcel(BcelUtils.java:0)
at com.intellij.uiDesigner.ant.Javac2.compile(Javac2.java:43)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
at org.apache.tools.ant.Task.perform(Task.java:341)
...
at org.apache.tools.ant.Main.main(Main.java:235)
Caused by: java.lang.NoSuchFieldException: _repository
at java.lang.Class.getDeclaredField(Class.java:1208)
at com.intellij.util.BcelUtils.disposeBcel(BcelUtils.java:32)
... 10 more
Total time: 7 seconds
]]>
My environment:
o Mac OS X 10.3
o java version "1.4.2_03"
o IDEA 4.0
From the prior postings, this task appears to work without much effort for other folks -- is there a quirk with the Mac OS JDK? Or am I doing something incredibly stupid? Will this task be openly documented in a future release?
Many thanks, & keep up the great work,
Peter
Please sign in to leave a comment.
Javac2 accepts the same parameters as ordinary javac? but also compiles IDEA form files/ In order for it to work you should have
bcel.jar and jdom.jar libraries form IDEA distribution in ant's classpath.
--
Best regards,
Eugene Zhuravlev
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"