I am facing annotation/persistence errors in a project and the persistence library throws a
NullPointerException when trying to resolve the entitie
From what I understand, you want debug in the compilation- not maven in debug mode.
Using mvn to compile, use debug mode through following way:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>8</source>
<target>8</target>
<debug>true</debug>
<debuglevel>lines,vars,source</debuglevel>
</configuration>
</plugin>
debuglevel can be any of the three values entered in CSV format To highlight, debug and debuglevel are important nodes included in the maven.
Hope it helps in some way.
Reference: maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html
You need to have the jpda.listen=maven
property set.
In Netbeans 8+:
1. Select the module you want to debug when building.
2. Right-click to open the context menu, and select Properties
.
3. Select the Actions
category.
4. Then select the Clean and build project
Action.
5. Under the Set Properties
section, select Add
> Debug Maven Build
.
6. Click the OK
button to close and save your settings.
Now you should be able to set breakpoints and debug maven plugins and dependencies.
You can debug any Maven goal in NetBeans going to /Project Properties/Actions/
, select the goal you wan to debug, in the last option Set Properties choose Add, and then select Debug Maven build.
You would need to set your breakpoints in the org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor
class, and that should stop during the start up of your server (which you would need to start in debug mode). This is not really compilation, but just JPA loading its metadata from class annotations. Because your JPA provider's code is not something you can understand easily or modify, I would suggest that instead of debugging you try searching for your specific error on the net and see if somebody else has experienced it (i.e. might be a bug on Eclipse Link), it's common for these libraries to throw uninformative exceptions like a Null Pointer when your entities are not annotated correctly.
Are you running Maven in debug mode?
To run Maven in debug mode, use the command mvnDebug instead of mvn to build your project and then attach to it using your IDE. Debug breakpoints should be hit.
I've done this with Eclipse, mostly when trying to debug my own annotation processors, but it's also handy for debugging Maven plugins.
I'd imagine debugging a JPA processor would not be trivial - you might be better off looking at the whole error message again or posting it in your question.