Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I compile in debug mode? (netbeans, java, maven)

I am facing annotation/persistence errors in a project and the persistence library throws a

NullPointerException when trying to resolve the entities (org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.discoverMappedSuperclassesAndInheritanceParents(EntityAccessor.java:224)).

How do I debug errors like these to find more about the cause of the error?

Setting a breakpoint in EntityAccessor and compiling for debug doesn't work, the compiler itself seems to be not running in debug mode.

I am using Netbeans / Java / Maven.

like image 902
Clemens Lode Avatar asked Nov 16 '11 16:11

Clemens Lode


1 Answers

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

like image 160
Vishal Verma Avatar answered Oct 06 '22 11:10

Vishal Verma