Uploaded image for project: 'Maven Compiler Plugin'
  1. Maven Compiler Plugin
  2. MCOMPILER-355

NPE in CompilerMojo.preparePaths on exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Resolved
    • None
    • None
    • None
    • ubunutu 18.04.

    Description

      I'm getting:

       

       
      Caused by: java.lang.NullPointerException
       at org.apache.maven.plugin.compiler.CompilerMojo.preparePaths (CompilerMojo.java:244)
       at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:787)
       at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:188)
       at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
      

       

      Appears to be caused by the exception handling assuming the 'cause' will be non-null:

          line 244 is:   

       243 Throwable cause = pathException.getValue().getCause();
       244 while ( cause.getCause() != null )
       245 { 
       246     cause = cause.getCause(); 
       247 }

       

      Clearly in some cases pathException.getValue().getCause() is returning null.

       This occurs when I try to build a java 10 project using:

      mvn deploy

       

      I've narrowed the problem down to this dependancy:

      <!-- https://mvnrepository.com/artifact/org.javamoney/moneta --> <dependency>
       <groupId>org.javamoney</groupId>
       <artifactId>moneta</artifactId>
       <version>1.3</version>
       <type>pom</type>
       </dependency>

      If you remove the above dependency then the problem goes away.

      So there is likely to be two problems here. The initial NPE which should be easy to fix and then possibly the root cause of the exception.

      Full pom is:

      <project xmlns="http://maven.apache.org/POM/4.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
       <modelVersion>4.0.0</modelVersion>
       <groupId>au.com.noojee</groupId>
       <artifactId>noojeebilling.api</artifactId>
       <version>1.4-SNAPSHOT</version>
       <properties>
       </properties>
       <build>
       <sourceDirectory>src/main/java</sourceDirectory>
       <plugins>
       <plugin>
       <artifactId>maven-compiler-plugin</artifactId>
       <version>3.8.0</version>
       <configuration>
       <release>10</release>
       </configuration>
       </plugin>
       </plugins>
      <extensions>
       <extension>
       <groupId>io.packagecloud.maven.wagon</groupId>
       <artifactId>maven-packagecloud-wagon</artifactId>
       <version>0.0.6</version>
       </extension>
       </extensions>
       </build>
      <distributionManagement>
       <repository>
       <id>noojee-internal</id>
       <url>packagecloud+https://packagecloud.io/noojee/internal</url>
       </repository>
       <snapshotRepository>
       <id>noojee-internal</id>
       <url>packagecloud+https://packagecloud.io/noojee/internal</url>
       </snapshotRepository>
       </distributionManagement>
       
      <dependencies>
       <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
       <dependency>
       <groupId>com.google.code.gson</groupId>
       <artifactId>gson</artifactId>
       <version>2.8.5</version>
       </dependency>
      <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
       <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-core</artifactId>
       <version>2.9.1</version>
       </dependency>
      <!-- https://mvnrepository.com/artifact/org.javamoney/moneta -->
       <dependency>
       <groupId>org.javamoney</groupId>
       <artifactId>moneta</artifactId>
       <version>1.3</version>
       <type>pom</type>
       </dependency>
       <!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on -->
       <dependency>
       <groupId>org.bouncycastle</groupId>
       <artifactId>bcprov-jdk15on</artifactId>
       <version>1.59</version>
       </dependency>
      <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>4.11</version>
       <scope>test</scope>
       </dependency>
       
      </dependencies>
      </project>
      

       

       

       

       

       

       

      Attachments

        1. testpom.zip
          1 kB
          Brett Sutton

        Issue Links

          Activity

            People

              rfscholte Robert Scholte
              bsutton Brett Sutton
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: