This is an automated email from the ASF dual-hosted git repository.

gaul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jclouds.git

commit 8ac994c2b5d509ca2877efdd77c35881d58ac3e3
Author: gurkerl83 <[email protected]>
AuthorDate: Thu Jul 2 10:54:28 2020 +0200

    Integrate GSON library in Clouds Core Bundle Final
    
    In the last commit (last section of squashed commit), the GSON library was 
integrated into the JClouds core module using maven-bundle plugins include 
resource instruction. Building OSGi instruction variables from the respective 
modules show a weakness when resources such as script builder shell scripts are 
required to be integrated into the bundle but not provide a dedicated variable 
declaration for the resource section.
    
    The following commit demonstrates a change in strategy in declaration and 
integration of OSGi metadata.
    
    - Replace old bundle-plugin with newest bnd-plugin (bundle-plugin uses 
bnd-plugin internally)
    - Move OSGi metadata declarations from a maven variable passing strategy 
into dedicated bnd.bnd files
    + Cleaner pom files, no bundle packaging
    + Intellisense / Autocomplete support for .bnd files in terms of package 
exports etc.
    
    For demonstration, the overall OSGi adjustments are limited to project, 
core, script builder, compute, blob store, and load balancer because most 
custom OSGi metadata is defined here.
    
    Note: Other modules are currently disabled from build because some feedback 
is needed first.
    
    Make GSON integration work.
    To understand the changes, see the core modules' bnd file. GSON internal 
packages also define a version. Both already exported and new export 
declarations are fused. The global JClouds core module exports defined the 
entire set of GSON packages available.
    
    Some minor modifications were made in the module project; replace maven jar 
plugin with a minified version of the declaration, outsourced in projects bnd 
file.
---
 blobstore/bnd.bnd     |  2 ++
 blobstore/pom.xml     |  9 ------
 compute/bnd.bnd       |  6 ++++
 compute/pom.xml       | 16 ----------
 core/bnd.bnd          | 17 +++++++++++
 core/pom.xml          | 11 -------
 loadbalancer/bnd.bnd  |  5 +++
 loadbalancer/pom.xml  |  7 -----
 pom.xml               |  8 +++--
 project/bnd.bnd       | 26 ++++++++++++++++
 project/pom.xml       | 85 +++++++++++++++++++++++++--------------------------
 scriptbuilder/bnd.bnd |  5 +++
 scriptbuilder/pom.xml | 17 -----------
 13 files changed, 107 insertions(+), 107 deletions(-)

diff --git a/blobstore/bnd.bnd b/blobstore/bnd.bnd
new file mode 100644
index 0000000..a31866a
--- /dev/null
+++ b/blobstore/bnd.bnd
@@ -0,0 +1,2 @@
+Export-Package: \
+    org.jclouds.blobstore.*;version="${project.version}";-noimport:=true
\ No newline at end of file
diff --git a/blobstore/pom.xml b/blobstore/pom.xml
index 95d05b2..7cd7beb 100644
--- a/blobstore/pom.xml
+++ b/blobstore/pom.xml
@@ -28,7 +28,6 @@
   <artifactId>jclouds-blobstore</artifactId>
   <name>jclouds blobstore core</name>
   <description>jclouds components to access blobstore</description>
-  <packaging>bundle</packaging>
 
   <scm>
     
<connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/blobstore</connection>
@@ -37,14 +36,6 @@
     <tag>HEAD</tag>
   </scm>
 
-  <properties>
-    <jclouds.osgi.import>
-      org.jclouds;version="${project.version}",
-      *
-    </jclouds.osgi.import>
-    
<jclouds.osgi.export>org.jclouds.blobstore*;version="${project.version}";-noimport:=true</jclouds.osgi.export>
-  </properties>
-
   <dependencies>
     <dependency>
       <groupId>${project.groupId}</groupId>
diff --git a/compute/bnd.bnd b/compute/bnd.bnd
new file mode 100644
index 0000000..860f616
--- /dev/null
+++ b/compute/bnd.bnd
@@ -0,0 +1,6 @@
+Export-Package: \
+    org.jclouds.cim.*;version="${project.version}";-noimport:=true, \
+    org.jclouds.compute.*;version="${project.version}";-noimport:=true, \
+    org.jclouds.net.*;version="${project.version}";-noimport:=true, \
+    org.jclouds.ovf.*;version="${project.version}";-noimport:=true, \
+    org.jclouds.ssh.*;version="${project.version}";-noimport:=true
\ No newline at end of file
diff --git a/compute/pom.xml b/compute/pom.xml
index fc1e818..0916869 100644
--- a/compute/pom.xml
+++ b/compute/pom.xml
@@ -29,22 +29,6 @@
   <artifactId>jclouds-compute</artifactId>
   <name>jclouds compute core</name>
   <description>jclouds components to access compute providers</description>
-  <packaging>bundle</packaging>
-
-  <properties>
-    <jclouds.osgi.import>
-      org.jclouds;version=${project.version},
-      org.jclouds*;version=${project.version},
-      *
-    </jclouds.osgi.import>
-    <jclouds.osgi.export>
-      org.jclouds.cim*;version=${project.version};-noimport:=true,
-      org.jclouds.compute*;version=${project.version};-noimport:=true,
-      org.jclouds.net*;version=${project.version};-noimport:=true,
-      org.jclouds.ovf*;version=${project.version};-noimport:=true,
-      org.jclouds.ssh*;version=${project.version};-noimport:=true
-    </jclouds.osgi.export>
-  </properties>
 
   <dependencies>
     <dependency>
diff --git a/core/bnd.bnd b/core/bnd.bnd
new file mode 100644
index 0000000..d5be7d9
--- /dev/null
+++ b/core/bnd.bnd
@@ -0,0 +1,17 @@
+Export-Package: \
+    org.jclouds.*;version=${project.version};-noimport:=true
+
+Bundle-Activator: org.jclouds.osgi.Activator
+
+-includeresource: \
+    lib/gson-${gson.version}.jar=gson-${gson.version}.jar;lib:=true
+
+-exportcontents: \
+    com.google.gson, \
+    com.google.gson.annotations, \
+    com.google.gson.reflect, \
+    com.google.gson.stream, \
+    com.google.gson.internal;version=${gson.version}, \
+    com.google.gson.internal.bind;version=${gson.version}, \
+    com.google.gson.internal.bind.util;version=${gson.version}, \
+    com.google.gson.internal.reflect;version=${gson.version}
diff --git a/core/pom.xml b/core/pom.xml
index b27bd0e..939a332 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -27,7 +27,6 @@
   </parent>
   <artifactId>jclouds-core</artifactId>
   <name>jclouds Components Core</name>
-  <packaging>bundle</packaging>
   <description>Core components to access jclouds services</description>
 
   <scm>
@@ -37,16 +36,6 @@
     <tag>HEAD</tag>
   </scm>
 
-  <properties>
-    <jclouds.osgi.import>*</jclouds.osgi.import>
-    <!-- https://issues.apache.org/jira/browse/JCLOUDS-1529 -->
-    <jclouds.osgi.export>
-      org.jclouds*;version=${project.version};-noimport:=true
-    </jclouds.osgi.export>
-    
<jclouds.osgi.include>lib/gson-${gson.version}.jar=gson-${gson.version}.jar;lib:=true</jclouds.osgi.include>
-    <jclouds.osgi.activator>org.jclouds.osgi.Activator</jclouds.osgi.activator>
-  </properties>
-
   <dependencies>
     <dependency>
       <groupId>javax.ws.rs</groupId>
diff --git a/loadbalancer/bnd.bnd b/loadbalancer/bnd.bnd
new file mode 100644
index 0000000..20c432e
--- /dev/null
+++ b/loadbalancer/bnd.bnd
@@ -0,0 +1,5 @@
+Export-Package: \
+    org.jclouds.loadbalancer.*;version="${project.version}
+
+Fragment-Host: \
+    jclouds-core
\ No newline at end of file
diff --git a/loadbalancer/pom.xml b/loadbalancer/pom.xml
index 2637d2b..08b1f1c 100644
--- a/loadbalancer/pom.xml
+++ b/loadbalancer/pom.xml
@@ -28,13 +28,6 @@
   <artifactId>jclouds-loadbalancer</artifactId>
   <name>jclouds loadbalancer core</name>
   <description>jclouds components to access loadbalancer 
providers</description>
-  <packaging>bundle</packaging>
-
-  <properties>
-    
<jclouds.osgi.export>org.jclouds.loadbalancer*;version="${project.version}"</jclouds.osgi.export>
-    
<jclouds.osgi.import>org.jclouds*;version="${project.version}",*</jclouds.osgi.import>
-    
<jclouds.osgi.fragment>jclouds-core;bundle-version="[1.3,3)"</jclouds.osgi.fragment>
-  </properties>
 
   <dependencies>
     <dependency>
diff --git a/pom.xml b/pom.xml
index 4cab1eb..f388e20 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,19 +32,21 @@
     <module>project</module>
     <module>resources</module>
     <module>core</module>
-    <module>common</module>
+    <module>scriptbuilder</module>
+    <module>blobstore</module>
     <module>compute</module>
     <module>loadbalancer</module>
+    <!--
+    <module>common</module>
     <module>apis</module>
     <module>providers</module>
-    <module>blobstore</module>
     <module>skeletons</module>
     <module>drivers</module>
-    <module>scriptbuilder</module>
     <module>allcompute</module>
     <module>allblobstore</module>
     <module>allloadbalancer</module>
     <module>all</module>
+    -->
   </modules>
   
   <profiles>
diff --git a/project/bnd.bnd b/project/bnd.bnd
new file mode 100644
index 0000000..c751a54
--- /dev/null
+++ b/project/bnd.bnd
@@ -0,0 +1,26 @@
+Bundle-Developers:
+Bundle-DocURL:
+Bundle-License:
+Bundle-SCM:
+Bundle-Vendor:
+
+Specification-Title: \
+    jclouds ${project.name}\
+
+Specification-Vendor: \
+    jclouds
+
+Implementation-Vendor: \
+    jclouds
+
+Implementation-Vendor-Id: \
+    org.apache.jclouds
+
+Implementation-Version: \
+    ${project.version}
+
+X-Compile-Source-JDK: \
+    ${maven.compile.source}
+
+X-Compile-Target-JDK: \
+    ${maven.compile.target}
\ No newline at end of file
diff --git a/project/pom.xml b/project/pom.xml
index 1b47901..639479f 100644
--- a/project/pom.xml
+++ b/project/pom.xml
@@ -217,6 +217,10 @@
   </developers>
 
   <properties>
+
+    <bnd.version>5.1.0</bnd.version>
+    <maven-jar-plugin.version>3.0.1</maven-jar-plugin.version>
+
     <maven.compile.source>1.8</maven.compile.source>
     <maven.compile.target>1.8</maven.compile.target>
     <jdk.version>1.8</jdk.version>
@@ -260,7 +264,7 @@
         <groupId>com.google.code.gson</groupId>
         <artifactId>gson</artifactId>
         <version>${gson.version}</version>
-        <scope>provided</scope>
+        <scope>compile</scope>
       </dependency>
       <dependency>
         <groupId>com.google.code.findbugs</groupId>
@@ -438,6 +442,10 @@
     </testResources>
     <plugins>
       <plugin>
+        <groupId>biz.aQute.bnd</groupId>
+        <artifactId>bnd-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-release-plugin</artifactId>
         <version>2.4</version>
@@ -591,48 +599,6 @@
         </configuration>
       </plugin>
       <plugin>
-        <artifactId>maven-jar-plugin</artifactId>
-        <version>2.4</version>
-        <executions>
-          <execution>
-            <goals>
-              <goal>test-jar</goal>
-            </goals>
-          </execution>
-        </executions>
-        <configuration>
-          <archive>
-            <manifestEntries>
-              <Specification-Title>jclouds 
${project.name}</Specification-Title>
-              <Specification-Vendor>jclouds</Specification-Vendor>
-              <Implementation-Vendor>jclouds</Implementation-Vendor>
-              <Implementation-Vendor-Id>org.jclouds</Implementation-Vendor-Id>
-              
<Implementation-Version>${project.version}</Implementation-Version>
-              
<X-Compile-Source-JDK>${maven.compile.source}</X-Compile-Source-JDK>
-              
<X-Compile-Target-JDK>${maven.compile.target}</X-Compile-Target-JDK>
-            </manifestEntries>
-          </archive>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <version>2.3.7</version>
-        <extensions>true</extensions>
-        <configuration>
-          <obrRepository>NONE</obrRepository>
-          <instructions>
-            <Bundle-Activator>${jclouds.osgi.activator}</Bundle-Activator>
-            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-            <Export-Package>${jclouds.osgi.export}</Export-Package>
-            
<Import-Package>${guava.osgi.import},${jclouds.osgi.import}</Import-Package>
-            
<DynamicImport-Package>${jclouds.osgi.dynamic}</DynamicImport-Package>
-            <Fragment-Host>${jclouds.osgi.fragment}</Fragment-Host>
-            <Include-Resource>${jclouds.osgi.include}</Include-Resource>
-          </instructions>
-        </configuration>
-      </plugin>
-      <plugin>
         <artifactId>maven-checkstyle-plugin</artifactId>
         <version>3.0.0</version>
         <!-- configuration and dependencies set via profiles -->
@@ -666,6 +632,32 @@
       <plugins>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-jar-plugin</artifactId>
+          <version>${maven-jar-plugin.version}</version>
+          <configuration>
+            <archive>
+              
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+            </archive>
+          </configuration>
+        </plugin>
+        <plugin>
+          <groupId>biz.aQute.bnd</groupId>
+          <artifactId>bnd-maven-plugin</artifactId>
+          <version>${bnd.version}</version>
+          <configuration>
+            <bndfile>bnd.bnd</bndfile>
+          </configuration>
+          <executions>
+            <execution>
+              <id>bnd-process</id>
+              <goals>
+                <goal>bnd-process</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>3.8.0</version>
           <configuration>
@@ -1001,7 +993,8 @@
               <exclude>**/services/*LoggingModule</exclude>
               <exclude>**/services/*ApiMetadata</exclude>
               <exclude>**/services/*ProviderMetadata</exclude>
-
+              <!-- OSGi metadata rules -->
+              <exclude>**/bnd.bnd</exclude>
               <!-- prevent duplicating license -->
               <exclude>**/LICENSE.txt</exclude>
               <exclude>**/header.txt</exclude>
@@ -1025,6 +1018,10 @@
               <exclude>**/test.pub</exclude>
               <exclude>**/src/test/resources/**/ssh-*.pub</exclude>
 
+              <!-- temporary exclude due to minimized module declaration -->
+              
<exclude>**/providers/profitbricks/src/test/resources/html/maintenance-503.html</exclude>
+              
<exclude>**/providers/profitbricks/src/test/resources/html/fault-401.html</exclude>
+
               <!-- temporary files or those generated by IDE or SCM -->
               <exclude>**/target/**</exclude>
               <exclude>**/test-output/**</exclude>
diff --git a/scriptbuilder/bnd.bnd b/scriptbuilder/bnd.bnd
new file mode 100644
index 0000000..83573a4
--- /dev/null
+++ b/scriptbuilder/bnd.bnd
@@ -0,0 +1,5 @@
+Export-Package: \
+    org.jclouds.scriptbuilder.*;version="${project.version}";-noimport:=true
+
+Bundle-Activator: \
+    org.jclouds.scriptbuilder.functionloader.osgi.Activator
diff --git a/scriptbuilder/pom.xml b/scriptbuilder/pom.xml
index 9f713f5..48ae23b 100644
--- a/scriptbuilder/pom.xml
+++ b/scriptbuilder/pom.xml
@@ -28,26 +28,9 @@
   <artifactId>jclouds-scriptbuilder</artifactId>
   <name>jclouds script builder</name>
   <description>creates scripts that can be used to manage 
services</description>
-  <packaging>bundle</packaging>
 
   <properties>
     <jclouds.test.listener />
-
-    
<jclouds.osgi.activator>org.jclouds.scriptbuilder.functionloader.osgi.Activator</jclouds.osgi.activator>
-    
<jclouds.osgi.export>org.jclouds.scriptbuilder*;version="${project.version}";-noimport:=true</jclouds.osgi.export>
-    <!--
-      The following classes are only needed when using chef or other compute 
stuff:
-      i) org.jclouds.javax.annotation.Nullable
-      ii) org.jclouds.domain.Credentials
-      iii) java.inject.Inject
-    -->
-    <jclouds.osgi.import>
-        javax.inject*;resolution:=optional,
-        org.jclouds.domain*;version="${project.version}";resolution:=optional,
-        
org.jclouds.javax.annotation*;version="${project.version}";resolution:=optional,
-        org.jclouds*;version="${project.version}",
-        *
-    </jclouds.osgi.import>
   </properties>
 
   <dependencies>

Reply via email to