Using Ant Javac Adaptor

Multi tool use


Using Ant Javac Adaptor
I am trying to use the Eclipse compiler to perform my ant builds. Using this document http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-using_batch_compiler.htm I am trying to make my set-up. But i face the following error
Class not found: org.eclipse.jdt.core.JDTCompilerAdapter
What is the issue?
My aim is to run an Ant build outside of Eclipse but using the Eclipse compiler.
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
– Müller
May 13 '16 at 8:50
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
2 Answers
2
To use the
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
method inside Eclipse your Ant script must be shown in the 'Run > External Tools Configurations' menu in the 'Ant' section. In the configuration for your Ant script your must specify 'Run in the same JRE as the workspace' on the JRE tab.
To use this outside of Eclipse you need the org.eclipse.jdt.coreXXX.jar
and the jdtCompilerAdapter.jar
(extracted from the jdt jar). You need to put both these jars on the Ant classpath either by putting them in the Ant library folder or using the -lib
option.
org.eclipse.jdt.coreXXX.jar
jdtCompilerAdapter.jar
-lib
Thanks for the note. But how do i run it outside of Eclipse? I thought I just had to put the
jdtCompilerAdapter.jar
file into the ANT_HOME/lib
location.– Müller
May 13 '16 at 8:58
jdtCompilerAdapter.jar
ANT_HOME/lib
You need both the jdtCompilerAdapter and org.eclipse.jdt.core jars. Added to answer.
– greg-449
May 13 '16 at 9:37
Hi, Yes, I have added them to the lib of my Ant directory. I would like to know if its possible to compile using the eclipse compiler and JRE 8?
– Müller
May 13 '16 at 11:02
add ecj as dependency ...
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.6.1</version>
</dependency>
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Show us how you are trying to use this in Ant.
– greg-449
May 13 '16 at 8:45