You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Tom Eicher (Jira)" <ji...@apache.org> on 2023/01/17 17:24:00 UTC
[jira] [Commented] (NETBEANS-4191) JPA metamodel classes not indexed properly so IDE generates symbol not found message
[ https://issues.apache.org/jira/browse/NETBEANS-4191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17677853#comment-17677853 ]
Tom Eicher commented on NETBEANS-4191:
--------------------------------------
This issue is still relevant.
Somebody please have a look...
> JPA metamodel classes not indexed properly so IDE generates symbol not found message
> ------------------------------------------------------------------------------------
>
> Key: NETBEANS-4191
> URL: https://issues.apache.org/jira/browse/NETBEANS-4191
> Project: NetBeans
> Issue Type: Bug
> Components: cnd - Editor
> Affects Versions: 12.0, 11.3
> Environment: Windows 10 - 1607
> OpenJDK jdk8u242-b08
> apache-maven 3.6.3
> JavaEE 6 web application project
> EclipseLink JPA provider
> Eclipselink annotation processor
> Reporter: Miklos Krivan
> Priority: Major
> Attachments: nb-1.PNG, nb-2.PNG
>
>
> first scenario NB is not running everything is executed in a console window
> * maven clean install on my javaee web application project is successful
> * all of the metamodel classess are compiled into target/generated-sources/annotations folder
> * the project can be deployed in TomEE instance - run without any mistake
> second scenario:
> * clear all of the NetBeans cache from %USERPROFILE%/AppData/Local/NetBeans/Cache
> * now let's start the netbeans64.exe with my project
> * after a while (some minutes) it finishes indexing and red flags appears on some java source files (where JPA metamodel classess are used) All of the generated metamodel classes looks missing - see my attached nb-1.PNG file
> * now I do clean and build from the NetBeans and the read flags still appears because of the metamodel classes are not indexed (so not recognized)
> * now I have tried to open one of them and make some changes (space entered and deleted) so triggering the modification of the source Java file and look in the background the *.rapt and *_.sig suddenly appears in the Cache folder.
> * so I am proceed with all of them and finally all of the red flag disappears
> * no I make a new clean and build in the IDE and no red flag appears the project is clean now
> If I repeat the scenarios again the same result.
> I would like to inform you also that this problem not exists in NB 11.2 there only frequent freezing error happens during facelet scanning (full freeze of NetBeans) that is why I wanted to step forward.
> So finally I did somthing magic in my pom file:
>
> {code:java}
> // code placeholder
> <profile>
> <id>nb-modelgen-fix</id>
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-antrun-plugin</artifactId>
> <version>3.0.0</version>
> <executions>
> <execution>
> <id>modelgen-touch-files</id>
> <phase>install</phase>
> <goals>
> <goal>run</goal>
> </goals>
> <configuration>
> <target>
> <touch>
> <fileset id="model.elements" dir="src/main/java" includes="**/*.java">
> <containsregexp expression="(@Entity|@MappedSuperclass|@Embeddable)" casesensitive="yes" />
> </fileset>
> </touch>
> </target>
> </configuration>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
> </profile>
> {code}
> You see this is just for NB so I have changed also the NB actions for clean and build as well activating this profile.
> You see I just touch all of the modell classess after finishing the build (install phase) and this way NB make records in his cache finally based on the source change trigger.
> One more important thing I use the following annotation processor with maven-compiler plugin:
> {code:java}
> // code placeholder
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <annotationProcessors>
> <annotationProcessor>
> org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
> </annotationProcessor>
> </annotationProcessors>
> <compilerArgs>
> <arg>-Aeclipselink.persistenceunits=REFLEX-PU</arg>
> </compilerArgs>
> <source>1.8</source>
> <target>1.8</target>
> </configuration>
> </plugin>
> {code}
> and of course the build-helper plugin:
> {code:java}
> // code placeholder
> <plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>build-helper-maven-plugin</artifactId>
> <version>3.1.0</version>
> <executions>
> <execution>
> <id>add-source</id>
> <phase>generate-sources</phase>
> <goals>
> <goal>add-source</goal>
> </goals>
> <configuration>
> <sources>
> <source>${project.build.directory}/generated-sources/annotations</source>
> <source>${project.build.directory}/generated-sources/wsimport</source>
> </sources>
> </configuration>
> </execution>
> </executions>
> </plugin>
> {code}
> I have a feeling that the indexing algoritm should have been cahnged. Maybe triggers to early. The wsimport classes has no such problems.
> Even I have tried to change the generated source target folder as some people tried to suggest but that kind of magic did not worked at all just was many wasted time.
> So please help me if it is possible. Many thanks.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists