11

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 ?

Erwin Smout
  • 18,113
  • 4
  • 33
  • 52

4 Answers4

18

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.

Mark Cramer
  • 2,614
  • 5
  • 33
  • 57
thkala
  • 84,049
  • 23
  • 157
  • 201
  • 2
    I have these enabled, but I still do not get the option for Annotation Processing – cnfw Aug 02 '14 at 12:46
  • The "Enable specific settings" seems to say that there are global settings for that, but it seems untrue. Also, link is down... – Matthieu May 19 '16 at 16:00
5

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
Dave Dopson
  • 41,600
  • 19
  • 95
  • 85
0

Maybe you are running a multi-module project. You are looking for the annotation processing tab in the parent project which might have a <packaging>pom</packaging> in its pom.xml

If so, you won't find the tab here. Go to a specific project with packaging jar and you will see the tab.

I search for this a few hours, so maybe this helps someone saving time.

Janning Vygen
  • 8,877
  • 9
  • 71
  • 102
0

I spent full day , you can do it next way:

  1. add lombok to maven pom.xml
  2. install eclipse
  3. download lombok
  4. copy to eclipse folder
  5. add to file eclipse.ini next text -javaagent:lombok.jar
  6. active annotation processing in:
    • select project(not the parent) ->properties->Java compiler ->annotation processing
    • Select Enable project specific settings
    • Select all Enable checkbox
  7. restart and it should work .

test ubuntu 20.04 and eclipse 2021 year

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459