You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ha...@apache.org on 2015/11/25 02:55:19 UTC

[09/21] incubator-brooklyn git commit: [BROOKLYN-185] Inline swagger-core and swagger-jaxrs into brooklyn-utils-rest-swagger

[BROOKLYN-185] Inline swagger-core and swagger-jaxrs into brooklyn-utils-rest-swagger

swagger-core and swagger-jaxrs versions 1.5.3 have package
io.swagger.config, which leads to a split-package situation.
The selected workaround is to inline both these dependencies into
brooklyn-utils-rest-swagger and re-export them for higher level client
code. When brooklyn moves to guava-18.0 we can migrate to swagger 1.5.4,
which are properly bundled.


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/c61f719a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/c61f719a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/c61f719a

Branch: refs/heads/master
Commit: c61f719a50d10908e2c2dd4a3b4539173d540ae6
Parents: c718ff3
Author: Ciprian Ciubotariu <ch...@gmx.net>
Authored: Wed Nov 18 17:51:29 2015 +0200
Committer: Ciprian Ciubotariu <ch...@gmx.net>
Committed: Wed Nov 18 17:51:29 2015 +0200

----------------------------------------------------------------------
 karaf/features/src/main/feature/feature.xml     | 12 ++--
 .../features/src/main/history/dependencies.xml  |  4 +-
 utils/rest-swagger/pom.xml                      | 64 +++++++++++++++++++-
 3 files changed, 69 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c61f719a/karaf/features/src/main/feature/feature.xml
----------------------------------------------------------------------
diff --git a/karaf/features/src/main/feature/feature.xml b/karaf/features/src/main/feature/feature.xml
index 46f7a0e..384bc7d 100644
--- a/karaf/features/src/main/feature/feature.xml
+++ b/karaf/features/src/main/feature/feature.xml
@@ -27,10 +27,11 @@
     <!--<bundle dependency="true">mvn:javax.ws.rs/jsr311-api/${jsr311-api.version}</bundle>-->
     <!--<bundle dependency="true">mvn:javax.ws.rs/javax.ws.rs-api/${javax.ws.rs-api}</bundle>-->
 
-    <feature name="swagger" version="${swagger.version}" description="Swagger Annotations+Core+JAXRS+Models">
+    <!-- temporary feature until we migrate to swagger-1.5.4, which is properly bundled -->
+    <feature name="swagger-crippled" version="${swagger.version}" description="Swagger Annotations+Core+JAXRS+Models">
         <bundle>mvn:io.swagger/swagger-annotations/${swagger.version}</bundle>
-        <bundle>wrap:mvn:io.swagger/swagger-core/${swagger.version}</bundle>
-        <bundle>wrap:mvn:io.swagger/swagger-jaxrs/${swagger.version}</bundle>
+<!--        <bundle>wrap:mvn:io.swagger/swagger-core/${swagger.version}</bundle>
+        <bundle>wrap:mvn:io.swagger/swagger-jaxrs/${swagger.version}</bundle>-->
         <bundle>mvn:io.swagger/swagger-models/${swagger.version}</bundle>
 
         <!--<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javassist/${javassist.bundle.version}</bundle>-->
@@ -41,9 +42,6 @@
         <bundle dependency='true'>mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/${fasterxml.jackson.version}</bundle>
         <bundle dependency='true'>mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/${fasterxml.jackson.version}</bundle>
         <bundle dependency='true'>mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/${fasterxml.jackson.version}</bundle>
-        <!--<bundle>mvn:com.thoughtworks.paranamer/paranamer/${thoughtworks.paranamer.version}</bundle>-->
-        <!--<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.json4s/${json4s.bundle.version}</bundle>-->
-        <!--<bundle dependency='true'>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.reflections/${reflections.bundle.version}</bundle>-->
     </feature>
 
     <feature name="brooklyn-utils-common" version="${project.version}" description="Brooklyn Common Utils">
@@ -70,7 +68,7 @@
 
     <feature name="brooklyn-utils-rest-swagger" version="${project.version}" description="Brooklyn REST Swagger Apidoc Utilities">
         <feature>brooklyn-utils-common</feature>
-        <feature version="${swagger.version}">swagger</feature>
+        <feature version="${swagger.version}">swagger-crippled</feature>
 
         <bundle>mvn:org.apache.brooklyn/brooklyn-utils-rest-swagger/${project.version}</bundle>
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c61f719a/karaf/features/src/main/history/dependencies.xml
----------------------------------------------------------------------
diff --git a/karaf/features/src/main/history/dependencies.xml b/karaf/features/src/main/history/dependencies.xml
index 1417ea8..98add88 100644
--- a/karaf/features/src/main/history/dependencies.xml
+++ b/karaf/features/src/main/history/dependencies.xml
@@ -17,7 +17,7 @@
         <feature prerequisite="false" dependency="false">brooklyn-utils-rest-swagger</feature>
         <feature prerequisite="false" dependency="false">brooklyn-utils-rest-swagger</feature>
         <feature prerequisite="false" dependency="false">jetty</feature>
-        <feature prerequisite="false" dependency="false">swagger</feature>
+        <feature prerequisite="false" dependency="false">swagger-crippled</feature>
         <feature prerequisite="false" dependency="false">war</feature>
         <feature prerequisite="false" dependency="false">war</feature>
         <bundle>mvn:ch.qos.logback/logback-classic/1.0.7</bundle>
@@ -96,8 +96,6 @@
         <bundle>mvn:org.yaml/snakeyaml/1.11</bundle>
         <bundle>wrap:mvn:com.google.http-client/google-http-client/1.18.0-rc</bundle>
         <bundle>wrap:mvn:com.maxmind.geoip2/geoip2/0.8.1</bundle>
-        <bundle>wrap:mvn:io.swagger/swagger-core/1.5.3</bundle>
-        <bundle>wrap:mvn:io.swagger/swagger-jaxrs/1.5.3</bundle>
         <bundle>wrap:mvn:javax.validation/validation-api/1.0.0.GA</bundle>
         <bundle>wrap:mvn:org.tukaani/xz/1.4</bundle>
         <bundle>wrap:mvn:xpp3/xpp3_min/1.1.4c</bundle>

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/c61f719a/utils/rest-swagger/pom.xml
----------------------------------------------------------------------
diff --git a/utils/rest-swagger/pom.xml b/utils/rest-swagger/pom.xml
index 61e5fa4..6f9a86f 100644
--- a/utils/rest-swagger/pom.xml
+++ b/utils/rest-swagger/pom.xml
@@ -19,7 +19,7 @@
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
-    <packaging>jar</packaging>
+    <packaging>bundle</packaging>
     
     <artifactId>brooklyn-utils-rest-swagger</artifactId>
     <name>Brooklyn REST Swagger Apidoc Utilities</name>
@@ -90,5 +90,67 @@
         </dependency>
 
     </dependencies>
+
+    <build>
+        <plugins>
+            <!--            <plugin>
+                <artifactId>maven-shade-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <artifactSet>
+                                <includes>
+                                    <include>io.swagger:swagger-core</include>
+                                    <include>io.swagger:swagger-jaxrs</include>
+                                </includes>
+                            </artifactSet>
+                            <finalName>${project.artifactId}-${project.version}-with-swagger</finalName>
+                            <outputFile>${project.build.directory}/${project.artifactId}-shaded-${project.version}.jar</outputFile>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>-->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <supportedProjectTypes>
+                        <supportedProjectType>jar</supportedProjectType>
+                        <supportedProjectType>bundle</supportedProjectType>
+                    </supportedProjectTypes>
+                    <excludeDependencies>brooklyn-util-common,brooklyn-logback-includes</excludeDependencies>
+                    <instructions>
+                        <!--
+                            This tells maven-bundle-plugin to include and export swagger-core and swagger-jaxrs into this bundle,
+                            but to not include other dependencies that are properly bundled themselves.
+                            We also need the swagger packages exported, since we're going to use them in higher-level bundles.
+
+                            The only way I could convince maven-bundle-plugin to do all this was to manually specify the packages
+                            in swagger-core and swagger-jaxrs versions 1.5.3
+
+                            FIXME: move to >=swagger-1.5.4 (which does not suffer from split packages and is a proper bundle),
+                            but those depend on guava-18.0 instead of brooklyn's currently used guava-17.x
+                        -->
+                        <Export-Package>
+                            org.apache.brooklyn.rest.*,
+                            io.swagger.config.*,
+                            io.swagger.converter.*,
+                            io.swagger.core.filter.*,
+                            io.swagger.jackson.*,
+                            io.swagger.model.*,
+                            io.swagger.util.*,
+                            io.swagger.jaxrs.*,
+                            !*
+                        </Export-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
     
 </project>