Skip to content

Commit

Permalink
Add maven toolchains
Browse files Browse the repository at this point in the history
  • Loading branch information
adangel committed Apr 10, 2016
1 parent 494719d commit 6be8547
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -15,7 +15,11 @@ Our latest source of PMD can be found on [GitHub]. Fork us!

### How to build PMD?

Simply use maven in the top-level directory:
You'll need to have a `~/.m2/toolchains.xml` file setup with jdk 1.6 (for pmd 5.3.x), jdk 1.7 (for pmd 5.4.x and pmd 5.5.x)
and jdk 1.8 (for some features in pmd 5.5.x). See [maven toolchains](https://maven.apache.org/guides/mini/guide-using-toolchains.html).
A example file can be found here: [example-toolchains.xml](https://github.com/pmd/pmd/blob/master/example-toolchains.xml).

Use maven in the top-level directory:

mvn clean package

Expand Down
32 changes: 32 additions & 0 deletions example-toolchains.xml
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF8"?>
<toolchains>
<!-- place this file in ${user.home}/.m2/toolchains.xml -->

<toolchain>
<type>jdk</type>
<provides>
<version>1.6</version>
</provides>
<configuration>
<jdkHome>/path/to/jdk/1.6</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>1.7</version>
</provides>
<configuration>
<jdkHome>/path/to/jdk/1.7</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
</provides>
<configuration>
<jdkHome>/path/to/jdk/1.8</jdkHome>
</configuration>
</toolchain>
</toolchains>
48 changes: 48 additions & 0 deletions pom.xml
Expand Up @@ -387,6 +387,25 @@
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>${java.version}</version>
</jdk>
</toolchains>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
Expand Down Expand Up @@ -557,6 +576,10 @@
<suppressionsFile>${checkstyle.suppressionsFile}</suppressionsFile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -897,6 +920,31 @@
<module>pmd-scala</module>
</modules>
</profile>

<profile>
<id>travis</id>
<activation>
<!-- https://github.com/travis-ci/travis-ci/issues/2727 -->
<!-- http://docs.travis-ci.com/user/ci-environment/#Environment-variables -->
<!-- from: https://github.com/marschall/jdeps-maven-plugin/blob/master/pom.xml -->
<property>
<name>env.TRAVIS</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-toolchains-plugin</artifactId>
<executions>
<execution>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<modules>
Expand Down

0 comments on commit 6be8547

Please sign in to comment.