FELIX-4550 : Only jetty bundle requires Java 7, move api package version to package-info, enable baselining

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1652398 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http/api/pom.xml b/http/api/pom.xml
index 4ad7848..115c7bf 100644
--- a/http/api/pom.xml
+++ b/http/api/pom.xml
@@ -46,7 +46,7 @@
                     <instructions>
                         <Export-Package>
                             org.osgi.service.http;version=${http.service.version},
-                            org.apache.felix.http.api;version=${project.version}
+                            org.apache.felix.http.api
                         </Export-Package>
                         <Import-Package>
                             org.osgi.service.http,
diff --git a/http/api/src/main/java/org/apache/felix/http/api/package-info.java b/http/api/src/main/java/org/apache/felix/http/api/package-info.java
new file mode 100644
index 0000000..ac502ad
--- /dev/null
+++ b/http/api/src/main/java/org/apache/felix/http/api/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+@Version("2.0.4")
+package org.apache.felix.http.api;
+
+import aQute.bnd.annotation.Version;
+
diff --git a/http/base/pom.xml b/http/base/pom.xml
index 222447c..86a79d9 100644
--- a/http/base/pom.xml
+++ b/http/base/pom.xml
@@ -76,7 +76,7 @@
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>org.apache.felix.http.api</artifactId>
-            <version>[2.0,3.0)</version>
+            <version>2.3.2</version>
         </dependency>
     </dependencies>
 
diff --git a/http/bundle/pom.xml b/http/bundle/pom.xml
index bb9993b..0e40066 100644
--- a/http/bundle/pom.xml
+++ b/http/bundle/pom.xml
@@ -83,6 +83,8 @@
                             *
                         </Import-Package>
                     </instructions>
+                    <!-- Skip baselining -->
+                    <skip>true</skip>
                 </configuration>
             </plugin>
         </plugins>
diff --git a/http/jetty/pom.xml b/http/jetty/pom.xml
index 92a1e61..2cac597 100644
--- a/http/jetty/pom.xml
+++ b/http/jetty/pom.xml
@@ -38,6 +38,7 @@
     </scm>
     
     <properties>
+        <http.java.version>7</http.java.version>
     	<!-- jetty.version is moved to http-parent POM -->
     </properties>
 
diff --git a/http/parent/pom.xml b/http/parent/pom.xml
index 249fb0d..eb63a57 100755
--- a/http/parent/pom.xml
+++ b/http/parent/pom.xml
@@ -38,11 +38,20 @@
     </prerequisites>
 
     <properties>
-      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     	<jetty.version>9.2.6.v20141205</jetty.version>
     	<cometd.version>2.8.0</cometd.version>
     	<http.service.version>1.2.1</http.service.version>
     	<servlet.version>3.1.0</servlet.version>
+        <!--
+            Java API and class file compliance. This property supports
+            one of three values:
+              - 6: Java 6 (default)
+              - 7: Java 7 
+            Using anything else causes the set-bundle-required-execution-environment
+            to fail the build with an exception
+        -->
+        <http.java.version>6</http.java.version>
     </properties>
 
     <scm>
@@ -54,11 +63,45 @@
     <build>
         <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 bree = "J2SE-1.6";
+                                    var httpJavaVersion = System.getProperty("http.java.version");
+                                    if (!httpJavaVersion) {
+                                        httpJavaVersion = project.getProperty("http.java.version");
+                                    }
+                                    if (httpJavaVersion == "7") {
+                                        bree = "JavaSE-1.7";
+	                                    System.out.println("Setting Bundle-RequiredExecutionEnvironment=" + bree + " from http.java.version=" + httpJavaVersion);
+                                    } else if (httpJavaVersion != "6") {
+                                        System.out.println("Unsupported http.java.version=" + httpJavaVersion + "; must be 6 or 7.");
+                                        throw "http.java.version must be 6 or 7";
+                                    }
+                                    project.setProperty("http.bree", bree);
+                                ]]></script>
+                            </target>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
-                    <source>1.7</source>
-                    <target>1.7</target>
-                    <compilerVersion>1.7</compilerVersion>
+	                <source>1.${http.java.version}</source>
+                    <target>1.${http.java.version}</target>
+                    <compilerVersion>1.${http.java.version}</compilerVersion>
                 </configuration>
             </plugin>
         </plugins>
@@ -76,20 +119,33 @@
                           <goal>bundle</goal>
                         </goals>
                       </execution>
+                      <execution>
+                        <id>baseline</id>
+                        <goals>
+                          <goal>baseline</goal>
+                        </goals>
+                      </execution>
                     </executions>
                     <configuration>
                         <instructions>
                             <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                             <Bundle-Version>${project.version}</Bundle-Version>
+                            <Bundle-RequiredExecutionEnvironment>${http.bree}</Bundle-RequiredExecutionEnvironment>
                         </instructions>                        
                     </configuration>
-                </plugin>
+                 </plugin>
             </plugins>
         </pluginManagement>
     </build>
 
     <dependencies>
         <dependency>
+            <groupId>biz.aQute</groupId>
+            <artifactId>bndlib</artifactId>
+            <version>1.50.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <version>4.8.2</version>
diff --git a/http/servlet-api/pom.xml b/http/servlet-api/pom.xml
index 058c62d..9b14426 100644
--- a/http/servlet-api/pom.xml
+++ b/http/servlet-api/pom.xml
@@ -57,6 +57,8 @@
                         </Export-Package>
 						<Embed-Dependency>tomcat-servlet-api;inline=true</Embed-Dependency>
                     </instructions>
+                    <!-- Skip baselining -->
+                    <skip>true</skip>
                 </configuration>
             </plugin>
         </plugins>
diff --git a/http/whiteboard/pom.xml b/http/whiteboard/pom.xml
index 304b888..fc25fa1 100644
--- a/http/whiteboard/pom.xml
+++ b/http/whiteboard/pom.xml
@@ -77,19 +77,13 @@
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>org.apache.felix.http.api</artifactId>
-            <version>[2.0,3)</version>
+            <version>2.3.2</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>org.apache.felix.http.base</artifactId>
-            <version>[2.4.0-SNAPSHOT,2.5)</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>biz.aQute</groupId>
-            <artifactId>bndlib</artifactId>
-            <version>1.50.0</version>
+            <version>2.4.0-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>