[ https://issues.apache.org/jira/browse/NETBEANS-5331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chris McGee updated NETBEANS-5331: ---------------------------------- Description: I'm working with an annotation processor contributed by an open source project that does annotation processing. It works using the [AbstractProcessor|https://docs.oracle.com/javase/7/docs/api/javax/annotation/processing/AbstractProcessor.html] API and is contributed automatically to client projects using a registered service. It works reasonably well with a Maven project in NetBeans 12.1. Errors produced by the annotation processor show up as you type, when you save and when you run mvn compile. It's all very interactive in NetBeans, which is great. The annotation processor also generated Java source code when it runs that are meant to be included along with the client project when it is compiled and packaged in target/generated-sources/annotations. When you build the client project initially maven runs the annotation processor and the filter places the generated source into that directory. When you edit the file in NetBeans nb-javac takes on the responsibility of compiling the code on save of each file, producing the compiled form of the file and also running the annotation processor. The problem is that when the annotation processor is invoked this way it places the generated source file in an entirely different directory. In my case it goes here: /Users/cmcgee/Library/Caches/NetBeans/12.1/index/s417/java/15/sources This leaves the original generated file stale compared to the client source code because it is a remnant of the original build of the project. Worse, when you run "mvn compile" it skips over the annotation processing of the source code file because nb-javac already produced the most up-to-date compiled byte codes (I think). The only workaround that I'm aware of is to turn off "Compile on Save" in the client project settings to force running maven to compile the project, but then not all users would think to do that, and you don't get the features of compiling every time you save. was: I'm working with an annotation processor contributed by an open source project that does annotation processing. It works using the [AbstractProcessor|https://docs.oracle.com/javase/7/docs/api/javax/annotation/processing/AbstractProcessor.html] API and is contributed automatically to client projects using a registered service. It works reasonably well with a Maven project in NetBeans 12.1. Errors produced by the annotation processor show up as you type, when you save and when you run mvn compile. It's all very interactive in NetBeans, which is great. The annotation processor also generated Java source code when it runs that are meant to be included along with the client project when it is compiled and packaged in target/generated-sources/annotations. When you build the client project initially maven runs the annotation processor and the filter places the generated source into that directory. When you edit the file in NetBeans nb-javac takes on the responsibility of compiling the code on save of each file, producing the compiled form of the file and also running the annotation processor. The problem is that when the annotation processor is invoked this way it places the generated source file in an entirely different directory. In my case it goes here: ```/Users/cmcgee/Library/Caches/NetBeans/12.1/index/s417/java/15/sources``` This leaves the original generated file stale compared to the client source code because it is a remnant of the original build of the project. Worse, when you run ```mvn compile``` it skips over the annotation processing of the source code file because nb-javac already produced the most up-to-date compiled byte codes. The only workaround that I'm aware of is to turn off "Compile on Save" in the client project settings to force running maven to compile the project, but then not all users would think to do that, and you don't get the features of compiling every time you save. > nb-javac annotation Filer doesn't put generated sources in the target > directory > ------------------------------------------------------------------------------- > > Key: NETBEANS-5331 > URL: https://issues.apache.org/jira/browse/NETBEANS-5331 > Project: NetBeans > Issue Type: Bug > Affects Versions: 12.1 > Reporter: Chris McGee > Priority: Major > > I'm working with an annotation processor contributed by an open source > project that does annotation processing. It works using the > [AbstractProcessor|https://docs.oracle.com/javase/7/docs/api/javax/annotation/processing/AbstractProcessor.html] > API and is contributed automatically to client projects using a registered > service. It works reasonably well with a Maven project in NetBeans 12.1. > Errors produced by the annotation processor show up as you type, when you > save and when you run mvn compile. It's all very interactive in NetBeans, > which is great. > The annotation processor also generated Java source code when it runs that > are meant to be included along with the client project when it is compiled > and packaged in target/generated-sources/annotations. When you build the > client project initially maven runs the annotation processor and the filter > places the generated source into that directory. When you edit the file in > NetBeans nb-javac takes on the responsibility of compiling the code on save > of each file, producing the compiled form of the file and also running the > annotation processor. The problem is that when the annotation processor is > invoked this way it places the generated source file in an entirely different > directory. In my case it goes here: > /Users/cmcgee/Library/Caches/NetBeans/12.1/index/s417/java/15/sources > This leaves the original generated file stale compared to the client source > code because it is a remnant of the original build of the project. Worse, > when you run "mvn compile" it skips over the annotation processing of the > source code file because nb-javac already produced the most up-to-date > compiled byte codes (I think). > The only workaround that I'm aware of is to turn off "Compile on Save" in the > client project settings to force running maven to compile the project, but > then not all users would think to do that, and you don't get the features of > compiling every time you save. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists