Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse java annotation processing

I want to do something using Annotation processing in eclipse jdt.

Eclipse jdtapt help tells me I should configure things on the java/compiler/annotation processing preferences page.

But on my installation (Indigo), the compiler section doesn't have this annotation processing subsection. It only has building,errors/warnings,javadoc, task tags.

Is something wrong with my installation ?

like image 754
Erwin Smout Avatar asked Mar 24 '12 10:03

Erwin Smout


People also ask

What is Eclipse annotation processing?

A Java annotation processor is a compiler plug-in that can gather information about source code as it is being compiled, generate additional Java types or other resource files, and post warnings and errors.

What is annotation process in Java?

An annotation is a construct associated with Java source code elements such as classes, methods, and variables. Annotations provide information to a program at compile time or at runtime based on which the program can take further action.


2 Answers

The annotation processing tab does not exist in the Preferences page that is accessible from the Eclipse menu bar. It is a project-specific menu that is accessible if you right-click on a project in the Project Explorer and select Preferences in the pop-up menu that will appear.

You may have to enable project-specific settings for the Java compiler tab and annotation processing explicitly before it will appear, as mentioned in this tutorial.

like image 76
thkala Avatar answered Oct 02 '22 20:10

thkala


I autogenerate my eclipse project files, so I prefer setting this stuff w/o using the UI ...

project/.factorypath:

<factorypath>
    <factorypathentry kind="WKSPJAR" id="../build/EpicBuilder.jar" enabled="true" runInBatchMode="false"/>
</factorypath>

project/.settings/org.eclipse.jdt.apt.core.prefs:

eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=true
org.eclipse.jdt.apt.genSrcDir=.apt_generated
org.eclipse.jdt.apt.reconcileEnabled=true

project/.settings/org.eclipse.jdt.core.prefs:

eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.processAnnotations=enabled
like image 20
Dave Dopson Avatar answered Oct 02 '22 20:10

Dave Dopson