Ant task for compiling GUI forms (Intellij IDEA)

How can I create an Ant task to compile GUI forms (XML) in Intellij IDEA? I use Scala and Java in my project. Java is only for the GUI class, and I create it using Intellij IDEA UI Designer.

+7
java user-interface scala intellij-idea ant
source share
5 answers

Please do not beat me, but after installing the "Generate Ant Build" dialog:

enter image description here

errors disappeared:

enter image description here

+9
source share

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.

+5
source share

Same problem. Solved as follows:

 <property name="idea.lib" value="C:\\Program Files (x86)\\JetBrains\\IntelliJ IDEA Community Edition 9.0.3\\lib"/> <path id="javac2.classpath"> <pathelement location="${idea.lib}/javac2.jar"/> <pathelement location="${idea.lib}/jdom.jar"/> <pathelement location="${idea.lib}/asm.jar"/> <pathelement location="${idea.lib}/asm-commons.jar"/> <pathelement location="${idea.lib}/jgoodies-forms.jar"/> </path> <taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath"/> 
+2
source share

Since this appears on google, here is what you need:

 <property name="javac2.home" value="${idea.home}/lib"/> <path id="javac2.classpath"> <pathelement location="${javac2.home}/asm.jar"/> <pathelement location="${javac2.home}/asm-all.jar"/> <pathelement location="${javac2.home}/javac2.jar"/> <pathelement location="${javac2.home}/jdom.jar"/> <pathelement location="${javac2.home}/asm-commons.jar"/> <pathelement location="${javac2.home}/jgoodies-forms.jar"/> </path> 

The asm and asm-all key that solves ClassReader and ClassWriter errors. I had to look into the banks to find out. "javac2.home" will be OS dependent. This is on Intellij Ultimate.

+1
source share

Here is the correct way:

 <property name="javac2.home" value="C:\\Program Files (x86)\\JetBrains\\\IntelliJ IDEA 14.1.4\\lib"/> <path id="javac2.classpath"> <pathelement location="${javac2.home}/asm.jar"/> <pathelement location="${javac2.home}/asm-all.jar"/> <pathelement location="${javac2.home}/javac2.jar"/> <pathelement location="${javac2.home}/jdom.jar"/> <pathelement location="${javac2.home}/asm-commons.jar"/> <pathelement location="${javac2.home}/jgoodies-forms.jar"/> </path> 

Works for both Intellij Community and Ultimate. Tested in both. Just change it to your Intellij community path, so for example, "IntelliJ IDEA Community Edition 14.1.4."

+1
source share

All Articles