This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 184952

Summary: Annotation processing doesn't work in Maven projects
Product: projects Reporter: Matthieu.P
Component: MavenAssignee: Jesse Glick <jglick>
Status: REOPENED ---    
Severity: normal CC: arittner, dkonecny, jglick, pjiricka, sj-nb, ttfkam
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 178108    
Attachments: Sample case
Lombok compilaton error

Description Matthieu.P 2010-04-26 08:25:38 UTC
New 6.9 annotation processing feature is really great and works perfectly in java or jee projects. However, Netbeans doesn't process annotations in maven projects. 

It should look in project and libs META-INF/services directory to find annotations processors factories.
Comment 1 David Simonek 2010-04-28 08:30:39 UTC
Please be more specific and tell us what exactly doesn't work and what error messages are you getting.
For example, @ServiceProvider annotations works OK for me - you just have to specify dependency of version 2.2 or higher of maven compiler plugin, because older versions don't process annotations correctly.
Comment 2 Matthieu.P 2010-04-28 11:45:36 UTC
Yep sorry i should have been more specific.

The issue is with annotation processing inside the IDE (the new feature of 6.9) not at compilation time. 

When i use Lombok for example, the @Data annotation adds getters and setters for all properties in my class. Those methods appears in the navigator window, and in auto completion on a Java project.

Now in my maven project, annotations are not processed and i can't use methods normally added by lombok. 

This is an IDE related issue i think.
Comment 3 Jesse Glick 2010-04-28 19:21:45 UTC
(In reply to comment #2)
> The issue is with annotation processing inside the IDE (the new feature of 6.9)
> not at compilation time. 

I.e. there is no AnnotationProcessingQueryImplementation in NbMavenProjectImpl.lookup.
Comment 4 Petr Jiricka 2010-06-16 11:42:40 UTC
This also affects the generation of the JPA canonical metamodel, see bug 181861.
Comment 5 Jesse Glick 2010-10-06 18:00:18 UTC
Created attachment 102289 [details]
Sample case
Comment 6 Jesse Glick 2010-10-06 18:35:30 UTC
core-main #8b313154fe61
Comment 7 Quality Engineering 2010-10-08 03:21:01 UTC
Integrated into 'main-golden', will be available in build *201010080000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/8b313154fe61
User: Jesse Glick <jglick@netbeans.org>
Log: #184952: Annotation processing doesn't work in Maven projects
Comment 8 jfurmankiewicz 2010-11-25 15:44:13 UTC
Does not work with either 0.9.2 or 0.9.3 in NB 7.0 Beta.
Ubuntu 10.10, Sun JDK 1.6.21

All classes annotated with any Lombok annotations (@Data, @EqualsAndHashCode, @ToString) show up with compilation errors. Same code works fine in Eclipse.

Will attach screenshot
Comment 9 jfurmankiewicz 2010-11-25 15:44:52 UTC
Created attachment 103332 [details]
Lombok compilaton error

Compilation error always shows up on package statement
Comment 10 jfurmankiewicz 2010-11-25 17:34:31 UTC
The code for my project is in git if you want to grab it and try to reproduce it:

https://github.com/jacek99/maven-python-mojos/tree/master/maven-python-mojos/maven-bdd-plugin/
Comment 11 Jan Lahoda 2010-11-25 21:07:12 UTC
This was fixed as bug #192142 post-7.0 beta.
Comment 12 Jesse Glick 2010-12-03 18:28:41 UTC
*** Bug 186965 has been marked as a duplicate of this bug. ***
Comment 13 nebrass 2017-08-07 15:53:43 UTC
I still have this issue on NetBeans 7.3.1:

Product Version: NetBeans IDE 7.3.1 (Build 201306052037)
Java: 1.6.0_43; Java HotSpot(TM) 64-Bit Server VM 20.14-b01
Runtime: Java(TM) SE Runtime Environment 1.6.0_43-b01

Please help !