Martin Kersten
Martin Kersten

Reputation: 5513

Maven Java Compiler Replacement?

I noticed many problems the JavaC has regarding Generics and the Eclipse compiler is obviously correct. Since JavaC and the problem it creates is part of our maven build process, I wonder if it is possible to remove the JavaC compiler and use another one.

I would like to know if there are other options than relying on JavaC during build. I know that the eclipse compiler is able to run in a headless mode. But I failed to find a maven compiler plugin for the Eclipse compiler.

Related To: Maven Compiler vs Eclipse Compiler Generics Difference?

Upvotes: 0

Views: 472

Answers (1)

Utku Özdemir
Utku Özdemir

Reputation: 7725

Check here, this should work: https://maven.apache.org/plugins/maven-compiler-plugin/non-javac-compilers.html

In pom.xml:

<project>
  [...]
  <build>
    [...]
    <plugins>
      [...]
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <compilerId>eclipse</compilerId>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-compiler-eclipse</artifactId>
            <version>1.6</version>
          </dependency>
        </dependencies>
      </plugin>
  [...]
</project>

Upvotes: 2

Related Questions