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

Compiler plugin (3.x) fails in eclipse

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.5
    • None
    • Maven-Compiler-Plugin: 3.1 (and maybe 3.0)
      Eclipse tycho compiler: 0.18.1
      Eclipse: Kepler 20130614-0229
      m2e: 1.4.0.20130601-0317

    Description

      Hi there,

      A few days ago we updated our eclipse to the new kepler version (also m2e) and decided to raise the maven-compiler-plugin version to the current one (3.1). After changing that, everything seemed to work fine, till some developers mentioned compile errors in the projects.

      Since m2e only marked the pom.xml of the projects, without any useful exception, i debugged the problem and found a NullPointerException in the maven-compiler-plugin.

      Since version 3.x there is a method called "isDependencyChanged" in the "AbstractCompilerMojo" class. This method calls another method called "getBuildStartTime". The getBuildStartTime method works fine, making some reflection calls to the MavenExecutionRequest to get its start time. Unfortunatly this time (Date object) never will be set (only in eclipse using m2e, running maven seems to work fine), so getBuildStartTime will return null. The null-value will be handed over (line 1166) to the method "hasNewFile" which fails (line 1192) when asking for "getTime".

      I didn't test the compiler-plugin 3.0, but i checked the source and this part seemed to be identical. We switched back to version 2.5.1 where the method does not exist - eventhing works again.

      Here is the buggy definition of our parent pom.

      <pluginManagement>
      <plugins>
      <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.1</version>
      <configuration>
      <compilerVersion>1.7</compilerVersion>
      <source>1.7</source>
      <target>1.7</target>
      <compilerId>jdt</compilerId>
      <compilerArguments>
      <verbose />
      </compilerArguments>
      </configuration>
      <dependencies>
      <dependency>
      <groupId>org.eclipse.tycho</groupId>
      <artifactId>tycho-compiler-jdt</artifactId>
      <version>0.18.1</version>
      </dependency>
      </dependencies>
      </plugin>
      </plugins>
      </pluginManagement>

      You also have to add a lifecycle mapping for m2e and change it from "ignore" to "execute". I didn't post this code since it comes with a quickfix.

      Be sure the parent pom is not in a open project when checking this problem. Just install the pom, close the project and refresh all other ones, using the pom. Sometimes everything works if the pom-project is checked out and open (not every time).

      kind regards
      Denis

      Attachments

        Activity

          People

            agudian Andreas Gudian
            hvollmilch Denis Günther
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: