Merge branch 'toolchains'

This commit is contained in:
Andreas Dangel
2016-04-10 17:05:18 +02:00
4 changed files with 86 additions and 11 deletions

View File

@ -15,7 +15,11 @@ Our latest source of PMD can be found on [GitHub]. Fork us!
### How to build PMD? ### 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 mvn clean package

View File

@ -69,15 +69,6 @@ echo "Releasing PMD"
echo "-------------------------------------------" echo "-------------------------------------------"
MVN_VERSION=$(mvn --version | grep "Java version: 1.7")
if [ $? -ne 0 ]; then
echo "Wrong java version!"
echo "Expected 1.7, but was:"
mvn --version
exit 1
fi
if [ "" = "$RELEASE_VERSION" ]; then if [ "" = "$RELEASE_VERSION" ]; then
echo -n "What is the release version of PMD? (e.g. 5.4.0) " echo -n "What is the release version of PMD? (e.g. 5.4.0) "
read RELEASE_VERSION read RELEASE_VERSION
@ -87,7 +78,7 @@ if [ "" = "$DEVELOPMENT_VERSION" ]; then
read DEVELOPMENT_VERSION read DEVELOPMENT_VERSION
fi fi
if [ "" = "$CURRENT_BRANCH" ]; then if [ "" = "$CURRENT_BRANCH" ]; then
echo -n "What is the branch you want to release from? (e.g. master or pmd/5.3.x) " echo -n "What is the branch you want to release from? (e.g. master or pmd/5.4.x or pmd/5.3.x) "
read CURRENT_BRANCH read CURRENT_BRANCH
fi fi

32
example-toolchains.xml Normal file
View File

@ -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
pom.xml
View File

@ -388,6 +388,25 @@
<runOrder>alphabetical</runOrder> <runOrder>alphabetical</runOrder>
</configuration> </configuration>
</plugin> </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> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId> <artifactId>build-helper-maven-plugin</artifactId>
@ -563,6 +582,10 @@
<suppressionsLocation>${checkstyle.suppressionsFile}</suppressionsLocation> <suppressionsLocation>${checkstyle.suppressionsFile}</suppressionsLocation>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
</plugin>
</plugins> </plugins>
</build> </build>
@ -941,6 +964,31 @@
<module>pmd-scala</module> <module>pmd-scala</module>
</modules> </modules>
</profile> </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> </profiles>
<modules> <modules>