Hi,

can you check that compile-on-save is disabled?

you should be able to pass the output dir directly to javac, without extra plugin.

something like this:

    <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
<generatedSourcesDirectory>${project.build.directory}/generated-sources/annotation-processors</generatedSourcesDirectory>
        </configuration>
    </plugin>


if you file a bug report, please attach a minimal reproducer project. Or post code snippets + steps.

regards,

-mbien


On 14.11.24 14:22, Tom Eicher wrote:
Hello,

so it seems that NetBeans will recognize the generated sources
as soon as they are in a directory like
xxx-ejb/target/generated-sources/hibernate-jpamodelgen/xxx/entity/Role_.java
but not in the real location
xxx-ejb/target/generated-sources/annotations/xxx/entity/Role_.java

NB sais the all generated sources must go into
"target/generated-sources/FOOBAR where FOOBAR is typically
the name of the plugin".

I don't quite see why "hibernate-jpamodelgen" is a valid FOOBAR
when "annotations" is not (especially when "typically" means it
is not a mandatory exact match on the plugin name).

So to fix this a lot of code is need in the POM as described here:
https://stackoverflow.com/a/43331054/459816
to modify the jpa-metamodelgen "defaultOutputDirectory".

Can one of the NB developers please comment on this?
I will gladly file a bug / feature request.

Many thanks Tom.



Am 12.11.24 um 17:20 schrieb Tom Eicher:

Hello,

I just upgraded to NB 23 (from 19), and it looks good
and feels faster and more refined, good job!

Now, I am also trying to finally migrate my old NB7 ant
ear build to maven.
(I assume there is still no kind of assistance for that, so I created
a project from wildfly-jakartaee-ear-archetype and adjusted manually)

So I got the ejb module to compile alright and among the things I
need is the jpa metamodel generation.

So my pom has:

         <dependency>
             <groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
             <version>5.2.16.Final</version>
             <scope>provided</scope>
         </dependency>

and the build works fine from command line using mvn clean package.

The build also works fine using the NB "clean" maven run, but afterwards
all usages of metamodel classes are marked red.

So e.g. I have a class
xxx.Role
and it's used in a xxx.RoleDAO but the
import xxx.Role_;
is marked red - "symbol Role_ not found".

I see

$ ls -l `find . -name "Role_.*"`
./xxx-ejb/target/classes/xxx/entity/Role_.class
./xxx-ejb/target/generated-sources/annotations/xxx/entity/Role_.java

and, the "Role_.java" is shown in the project view under
"Generated sources (annotations") in gray
and I can even open and look at the code,
but when I "Go to type", Role is known but Role_ is not.

Funny, I got the error resolved for a short time by moving the classes
mv ./xxx-ejb/target/classes ./xxx-ejb/target/generated-sources

I'm not sure if this is a misconfiguration, a version incompatibility,
a NB bug, or even the infamous NETBEANS-4191 cache issues that has been
plaguing me for the past 10 years, with the workaround "touch the
sources in the ant build afterwards" working most of the time.
But, manually touching source or classes files changes nothing in this
case.

So - how do you use jpa metamodelgen with NB and my?

Any input and discussion appreciated.

Cheers Tom.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to