Author: kwin Date: Fri Sep 29 08:23:22 2017 New Revision: 1810066 URL: http://svn.apache.org/viewvc?rev=1810066&view=rev Log: SLING-7132 add profile for java9 to leverage release option of javac
only use animal-sniffer for java < 9 Modified: sling/trunk/parent/pom.xml Modified: sling/trunk/parent/pom.xml URL: http://svn.apache.org/viewvc/sling/trunk/parent/pom.xml?rev=1810066&r1=1810065&r2=1810066&view=diff ============================================================================== --- sling/trunk/parent/pom.xml (original) +++ sling/trunk/parent/pom.xml Fri Sep 29 08:23:22 2017 @@ -52,14 +52,12 @@ - 6: Java 6 - 7: Java 7 (default) - 8: Java 8 - Using anything else causes the set-bundle-required-execution-environment - to fail the build with an exception + - 9: Java 9 --> <sling.java.version>7</sling.java.version> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> </properties> - <scm> <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/parent</connection> <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/parent</developerConnection> @@ -111,12 +109,26 @@ <build> <plugins> - <!-- Require Java 7 or higher for building (as bnd since version 3.0 is built with Java 7) --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>3.0.0-M1</version> <executions> + <execution> + <id>enforce-property-values</id> + <goals> + <goal>enforce</goal> + </goals> + <configuration> + <rules> + <requireProperty> + <property>sling.java.version</property> + <regex>[6-9]</regex> + <regexMessage>The property "sling.java.version" may only have one of the following values: 6, 7, 8 or 9.</regexMessage> + </requireProperty> + </rules> + </configuration> + </execution> <execution> <id>enforce-java</id> <goals> @@ -124,10 +136,10 @@ </goals> <configuration> <rules> + <!-- Require Java 7 or higher for building (as bnd since version 3.0 is built with Java 7) --> <requireJavaVersion> <message> - Apache Sling must be compiled with Java - 7 or higher + Apache Sling must be compiled with Java 7 or higher </message> <version>1.7.0</version> </requireJavaVersion> @@ -171,9 +183,6 @@ </executions> </plugin> - <!-- warn for SLING-443/SLING-1782 --> - - <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>ianal-maven-plugin</artifactId> @@ -190,19 +199,6 @@ </executions> </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>animal-sniffer-maven-plugin</artifactId> - <executions> - <execution> - <phase>test</phase> - <goals> - <goal>check</goal> - </goals> - </execution> - </executions> - </plugin> - <!-- override the default remote-resources configuration from the Apache pom to include our custom NOTICE file @@ -225,15 +221,6 @@ </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.${sling.java.version}</source> - <target>1.${sling.java.version}</target> - <encoding>${project.build.sourceEncoding}</encoding> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-release-plugin</artifactId> <dependencies> <dependency> @@ -290,6 +277,11 @@ <pluginManagement> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.7.0</version> + </plugin> + <plugin> <groupId>org.apache.sling</groupId> <artifactId>maven-sling-plugin</artifactId> <version>2.3.0</version> @@ -398,7 +390,7 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>animal-sniffer-maven-plugin</artifactId> - <version>1.15</version> + <version>1.16</version> <configuration> <signature> <groupId>org.codehaus.mojo.signature</groupId> @@ -642,6 +634,58 @@ </build> </profile> + <profile> + <id>jdk8-or-lower</id> + <activation> + <!-- syntax according to http://maven.apache.org/enforcer/enforcer-rules/versionRanges.html --> + <jdk>(,9)</jdk> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.${sling.java.version}</source> + <target>1.${sling.java.version}</target> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>animal-sniffer-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>jdk9-or-higher</id> + <activation> + <!-- syntax according to http://maven.apache.org/enforcer/enforcer-rules/versionRanges.html --> + <jdk>[9,)</jdk> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <!-- + release sets API classpath, source and target, see + https://docs.oracle.com/javase/9/tools/javac.htm#GUID-AEEC9F07-CB49-4E96-8BC7-BCC2C7F725C9__GUID-D343F6B4-3FDD-43A8-AD24-43DD70214471 + and http://openjdk.java.net/jeps/247 --> + <release>${sling.java.version}</release> + </configuration> + </plugin> + </plugins> + </build> + </profile> <!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. --> <profile> <id>only-eclipse</id> @@ -1084,7 +1128,6 @@ <scope>provided</scope> </dependency> - <dependency> <groupId>com.google.code.findbugs</groupId> <artifactId>jsr305</artifactId>