FELIX-4932 : Update pom to handle individual java base versions

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1685743 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom/pom.xml b/pom/pom.xml
index 778e1b2..86c21cb 100644
--- a/pom/pom.xml
+++ b/pom/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache</groupId>
         <artifactId>apache</artifactId>
-        <version>13</version>
+        <version>17</version>
         <relativePath />
     </parent>
 
@@ -33,17 +33,18 @@
     <version>3-SNAPSHOT</version>
     <url>http://felix.apache.org/</url>
     <inceptionYear>2006</inceptionYear>
-    <description>Apache Felix is an OSGi implementation.</description>
+    <description>Apache Felix is a community effort to implement the OSGi Framework and Service platform and other interesting OSGi-related technologies.</description>
+
+    <prerequisites>
+        <maven>3.0.5</maven>
+    </prerequisites>
 
     <properties>
         <sourceReleaseAssemblyDescriptor>source-release-zip-tar</sourceReleaseAssemblyDescriptor>
 
         <!-- Default Java VM and API compatibility -->
-        <felix.build.source>1.3</felix.build.source>
-        <felix.build.target>1.3</felix.build.target>
+        <felix.java.version>5</felix.java.version>
         <felix.java.signature.groupId>org.codehaus.mojo.signature</felix.java.signature.groupId>
-        <felix.java.signature.artifactId>java13-sun</felix.java.signature.artifactId>
-        <felix.java.signature.version>1.0</felix.java.signature.version>
         
         <!-- Default settings for the site plugins -->
         <site.javadoc.exclude>*.impl:*.internal:</site.javadoc.exclude>
@@ -98,24 +99,41 @@
         </pluginRepository>
     </pluginRepositories>
 
+    <dependencyManagement>
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.11</version>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <version>2.5.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <version>1.10.19</version>
+        </dependency>
+    </dependencies>
+    </dependencyManagement>
+
     <!-- definitions for testing -->
     <dependencies>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>4.0</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymock</artifactId>
-            <version>2.4</version>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
             <artifactId>mockito-all</artifactId>
-            <version>1.7</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
@@ -125,17 +143,12 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-project-info-reports-plugin</artifactId>
-                    <version>2.1</version>
+                    <version>2.8</version>
                 </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-jxr-plugin</artifactId>
-                    <version>2.1</version>
-                </plugin>
-                <plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-surefire-report-plugin</artifactId>
-                    <version>2.4.3</version>
+                    <version>2.5</version>
                 </plugin>
                 <plugin>
                     <groupId>org.codehaus.mojo</groupId>
@@ -145,18 +158,115 @@
                 <plugin>
                     <groupId>org.apache.rat</groupId>
                     <artifactId>apache-rat-plugin</artifactId>
-                    <version>0.7</version>
+                    <version>0.10</version>
                 </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-javadoc-plugin</artifactId>
-                    <version>2.9.1</version>
+                    <version>2.10.2</version>
                 </plugin>
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>animal-sniffer-maven-plugin</artifactId>
+                    <version>1.14</version>
+    	            <configuration>
+                        <signature>
+                            <groupId>${felix.java.signature.groupId}</groupId>
+                            <artifactId>${felix.java.signature.artifactId}</artifactId>
+                            <version>${felix.java.signature.version}</version>
+                        </signature>
+                    </configuration>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-antrun-plugin</artifactId>
+                    <version>1.8</version>
+                    <dependencies>
+                        <!-- declare dependencies here rather than where needed to
+                             circumvent http://jira.codehaus.org/browse/MANTRUN-51
+                        -->
+                        <dependency>
+                            <groupId>org.apache.ant</groupId>
+                            <artifactId>ant-apache-regexp</artifactId>
+                            <version>1.7.1</version>
+                            <scope>runtime</scope>
+                        </dependency>
+                        <dependency>
+                            <groupId>jakarta-regexp</groupId>
+                            <artifactId>jakarta-regexp</artifactId>
+                            <version>1.4</version>
+                        </dependency>
+                    </dependencies>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-site-plugin</artifactId>
+                    <version>3.3</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-report-plugin</artifactId>
+                    <version>2.18.1</version>
+               </plugin>
             </plugins>
         </pluginManagement>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>set-bundle-required-execution-environment</id>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <phase>initialize</phase>
+                        <configuration>
+                            <exportAntProperties>true</exportAntProperties>
+                            <target>
+                                <script language="javascript"> <![CDATA[
+                                    var System = java.lang.System;
+                                    var skipAnimalSniffer = false;
+                                    var animalSnifferSignaturesVersion = "1.0";
+                                    var animalSnifferSignaturesArtifactId = "java13-sun";
+
+                                    var felixJavaVersion = System.getProperty("felix.java.version");
+                                    if (!felixJavaVersion) {
+                                        felixJavaVersion = project.getProperty("felix.java.version");
+                                    }
+
+                                    if (felixJavaVersion == "4") {
+                                        animalSnifferSignaturesArtifactId = "java14-sun";
+                                    } else if (felixJavaVersion == "5") {
+                                        animalSnifferSignaturesArtifactId = "java15";
+                                    } else if (felixJavaVersion == "6") {
+                                        animalSnifferSignaturesArtifactId = "java16";
+										animalSnifferSignaturesVersion = "1.1";
+                                    } else if (felixJavaVersion == "7") {
+                                        animalSnifferSignaturesArtifactId = "java17";
+	                                } else if ( felixJavaVersion == "8") {
+                                        // there are no published signatures for Java 1.8, so skip execution. However, we also need a valid
+                                        // artifact in the signature, so fallback to the 1.7 signatures and skip checking entirely
+                                        // see also https://github.com/mojohaus/animal-sniffer/issues/1
+                                        animalSnifferSignaturesArtifactId = "java17";
+	                                    skipAnimalSniffer = true;
+	                                } else if ( felixJavaVersion != "3") {
+                                        System.out.println("Unsupported felix.java.version=" + felixJavaVersion + "; must be 3, 4, 5, 6, 7 or 8.");
+                                        throw "felix.java.version must be 3, 4, 5, 6, 7 or 8";
+                                    }
+	                                System.out.println("Using felix.java.version=" + felixJavaVersion);
+                                    project.setProperty("felix.bree", "JavaSE-1." + felixJavaVersion);
+                                    project.setProperty("felix.animal.sniffer.skip", skipAnimalSniffer);
+                                    project.setProperty("felix.java.signature.version", animalSnifferSignaturesVersion);
+                                    project.setProperty("felix.java.signature.artifactId", animalSnifferSignaturesArtifactId);
+                                ]]></script>
+                            </target>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-javadoc-plugin</artifactId>
                 <configuration>
                     <excludePackageNames>${site.javadoc.exclude}</excludePackageNames>
@@ -166,8 +276,8 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
-                    <source>${felix.build.source}</source>
-                    <target>${felix.build.target}</target>
+                    <source>1.${felix.java.version}</source>
+                    <target>1.${felix.java.version}</target>
                 </configuration>
             </plugin>
             <plugin>
@@ -194,14 +304,6 @@
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>animal-sniffer-maven-plugin</artifactId>
-                <version>1.7</version>
-                <configuration>
-                    <signature>
-                        <groupId>${felix.java.signature.groupId}</groupId>
-                        <artifactId>${felix.java.signature.artifactId}</artifactId>
-                        <version>${felix.java.signature.version}</version>
-                    </signature>
-                </configuration>
                 <executions>
                     <execution>
                         <phase>test</phase>
@@ -249,7 +351,7 @@
 		   <extension>
 		     <groupId>org.apache.maven.wagon</groupId>
 		     <artifactId>wagon-ssh</artifactId>
-		     <version>1.0-beta-6</version>
+		     <version>2.9</version>
 		   </extension>
         </extensions>
     </build>
@@ -258,7 +360,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-site-plugin</artifactId>
-                <version>2.2</version>
                 <configuration>
                     <templateDirectory>${user.dir}/src/site/</templateDirectory>
                     <template>maven-site.vm</template>
@@ -267,12 +368,10 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-report-plugin</artifactId>
-                <version>2.4.3</version>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-jxr-plugin</artifactId>
-                <version>2.1</version>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>