diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2018-04-25 03:09:05 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2018-04-25 11:18:08 +0200 |
commit | e8e456b519708aca430b998bf69ff3f214628c31 (patch) | |
tree | 0b445c011decb1fe0a9038ea2885b51eb5df42b3 /pom.xml | |
parent | 9edf9bf2d6fd248daf2157bc8245142e5d51f7c2 (diff) | |
download | jgit-e8e456b519708aca430b998bf69ff3f214628c31.tar.gz jgit-e8e456b519708aca430b998bf69ff3f214628c31.zip |
Use eclipse compiler in Maven build
Found instructions for configuring maven-compiler-plugin with ecj in
[1]. Verified that ecj run in this way raises build errors when executed
on commit d3ef5213.
Define profiles "ecj" for using Eclipse compiler and "javac" for using
javac including errorprone. By default ecj will be used.
use ecj:
$ mvn -Pecj clean install
use javac:
$ mvn -Pjavac clean install
TODO: find out how to run ecj with errorprone from Maven.
[1] https://stackoverflow.com/questions/33164976/using-eclipse-java-compiler-ecj-in-maven-builds
Change-Id: I716b603b57612b953e603387c82fd01eb1b5ca97
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'pom.xml')
-rw-r--r-- | pom.xml | 158 |
1 files changed, 101 insertions, 57 deletions
@@ -267,63 +267,6 @@ </plugin> <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.7.0</version> - <configuration> - <encoding>UTF-8</encoding> - <source>1.8</source> - <target>1.8</target> - </configuration> - <executions> - <execution> - <id>default-compile</id> - <phase>compile</phase> - <goals> - <goal>compile</goal> - </goals> - <configuration> - <includes> - <include>org/eclipse/jgit/transport/InsecureCipherFactory.java</include> - </includes> - </configuration> - </execution> - <execution> - <id>compile-with-errorprone</id> - <phase>compile</phase> - <goals> - <goal>compile</goal> - </goals> - <configuration> - <compilerId>javac-with-errorprone</compilerId> - <forceJavacCompilerUse>true</forceJavacCompilerUse> - <excludes> - <exclude>org/eclipse/jgit/transport/InsecureCipherFactory.java</exclude> - </excludes> - </configuration> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-compiler-javac</artifactId> - <version>2.8.2</version> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-compiler-javac-errorprone</artifactId> - <version>2.8.4</version> - </dependency> - <!-- override plexus-compiler-javac-errorprone's dependency on - Error Prone with the latest version --> - <dependency> - <groupId>com.google.errorprone</groupId> - <artifactId>error_prone_core</artifactId> - <version>2.3.1</version> - </dependency> - </dependencies> - </plugin> - - <plugin> <artifactId>maven-clean-plugin</artifactId> <version>3.0.0</version> </plugin> @@ -762,6 +705,107 @@ <profiles> <profile> + <id>javac</id> + <build> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <encoding>UTF-8</encoding> + <source>1.8</source> + <target>1.8</target> + </configuration> + <executions> + <execution> + <id>default-compile</id> + <phase>compile</phase> + <goals> + <goal>compile</goal> + </goals> + <configuration> + <includes> + <include>org/eclipse/jgit/transport/InsecureCipherFactory.java</include> + </includes> + </configuration> + </execution> + <execution> + <id>compile-with-errorprone</id> + <phase>compile</phase> + <goals> + <goal>compile</goal> + </goals> + <configuration> + <compilerId>javac-with-errorprone</compilerId> + <forceJavacCompilerUse>true</forceJavacCompilerUse> + <excludes> + <exclude>org/eclipse/jgit/transport/InsecureCipherFactory.java</exclude> + </excludes> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-compiler-javac</artifactId> + <version>2.8.2</version> + </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-compiler-javac-errorprone</artifactId> + <version>2.8.4</version> + </dependency> + <!-- override plexus-compiler-javac-errorprone's dependency on + Error Prone with the latest version --> + <dependency> + <groupId>com.google.errorprone</groupId> + <artifactId>error_prone_core</artifactId> + <version>2.3.1</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>ecj</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <build> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + <configuration> + <compilerId>eclipse</compilerId> + <encoding>UTF-8</encoding> + <source>1.8</source> + <target>1.8</target> + <!-- Passing arguments is a trainwreck, see https://issues.apache.org/jira/browse/MCOMPILER-123 --> + <compilerArguments> + <properties>${project.basedir}/.settings/org.eclipse.jdt.core.prefs</properties> + </compilerArguments> + <showWarnings>true</showWarnings> + <showDeprecation>true</showDeprecation> + </configuration> + <dependencies> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-compiler-eclipse</artifactId> + <version>2.8.4</version> + </dependency> + <dependency> + <groupId>org.eclipse.jdt</groupId> + <artifactId>ecj</artifactId> + <version>3.13.102</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + <profile> <id>static-checks</id> <build> <plugins> |