Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-22

Sources generated by Annotation Processor through Maven are not on classpath of Java Editor

    XMLWordPrintableJSON

Details

    Description

      I have attached two simple maven projects that use an Annotation Processor. The project mvn_immut uses the Immutables framework to generate immutable implementations from an interface. The project mvn_meta uses the JPA Metamodel AP. Both projects have a simple class or interface, Book.java, with annotations and a class with a main-method, that interacts with the sources generated by the AP (E.g. print something to System.out).

      'Clean and Build' and 'Run' work without a problem. I see a Generated Sources node appearing, containing the expected sources and when inspecting the target/classes directory, I see the class files of my handwritten code and of the generated code. However, the source file that uses the generated source, does not compile, as the java editor does not recognize the AP generated sources.

      I file this report under Maven component, because if I have the exact same source files in an Ant based project, there are no compilation problems.

      It appears to me that issue https://netbeans.org/bugzilla/show_bug.cgi?id=217556 is related to this one.

      Attachments

        1. mvn_meta.zip
          4 kB
          Dave Schoorl
        2. mvn_immut.zip
          4 kB
          Dave Schoorl

        Activity

          People

            Unassigned Unassigned
            dave_schoorl Dave Schoorl
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated: