changeset 280:262f254b0ac0

Sshared jar files reduce footprint from 120mb to 14 mb This patch shares most of the jar files instead of maintaining separate copies in each war file. The saving is 80MB on disk, and 10-30 MB in memory. before dist/target/image 120 mb image/services 82 mb image/libs 14 mb 140-160 mb serving jvms/0.0.1/tree after dist/target/image 16 mb image/services 1.71 mb image/libs 14 mb 110-140 mb serving jvms/0.0.1/tree
author Simon Tooke <stooke@redhat.com>
date Tue, 17 Oct 2017 08:49:58 -0400
parents 4ef47fad072a
children fdd31cc5e164
files common/core/pom.xml common/mongodb/pom.xml distribution/pom.xml services/commands/pom.xml services/jcmd/pom.xml services/jvm-byteman/pom.xml services/jvm-compiler/pom.xml services/jvm-cpu/pom.xml services/jvm-gc/pom.xml services/jvm-io/pom.xml services/jvm-memory/pom.xml services/jvms/pom.xml services/system-cpu/pom.xml services/system-memory/pom.xml services/system-network/pom.xml services/systems/pom.xml tests/integration-tests/pom.xml tests/pom.xml tests/test-utils/pom.xml
diffstat 19 files changed, 161 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/common/core/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/common/core/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -65,6 +65,7 @@
             <groupId>javax.ws.rs</groupId>
             <artifactId>javax.ws.rs-api</artifactId>
             <version>${javax-rs-api.version}</version>
+            <scope>provided</scope>
         </dependency>
 
         <!-- Keycloak dependencies -->
@@ -72,6 +73,7 @@
             <groupId>org.keycloak</groupId>
             <artifactId>keycloak-core</artifactId>
             <version>${keycloak.version}</version>
+            <scope>provided</scope>
         </dependency>
 
         <!-- test scoped deps -->
--- a/common/mongodb/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/common/mongodb/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -57,12 +57,14 @@
             <groupId>com.redhat.thermostat</groupId>
             <artifactId>thermostat-web-gateway-common-core</artifactId>
             <version>${project.version}</version>
+            <scope>provided</scope>
         </dependency>
         <!-- MongoDB dependencies -->
         <dependency>
             <groupId>org.mongodb</groupId>
             <artifactId>mongo-java-driver</artifactId>
             <version>${mongo-java-driver.version}</version>
+            <scope>provided</scope>
         </dependency>
         <!-- Servlet API deps -->
         <dependency>
@@ -71,7 +73,13 @@
       		<version>${javax.servlet.version}</version>
       		<scope>provided</scope>
     	</dependency>
-        
+        <!-- JAX-RS Dependencies -->
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+            <version>${javax-rs-api.version}</version>
+            <scope>provided</scope>
+        </dependency>
         <!-- test scoped deps -->
         <dependency>
             <groupId>junit</groupId>
@@ -88,7 +96,8 @@
         <dependency>
             <groupId>com.google.code.gson</groupId>
             <artifactId>gson</artifactId>
-            <version>2.2.4</version>
+            <version>${google-gson.version}</version>
+            <scope>provided</scope>
         </dependency>
     </dependencies>
 </project>
--- a/distribution/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/distribution/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -312,11 +312,26 @@
         </plugins>
     </build>
     <dependencies>
+        <!-- anything not marked as provided gets copied to target/image/libs -->
+        <dependency>
+            <groupId>com.redhat.thermostat</groupId>
+            <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>com.redhat.thermostat</groupId>
             <artifactId>thermostat-web-gateway-server</artifactId>
             <version>${project.version}</version>
         </dependency>
+
+        <!-- MongoDB dependencies -->
+        <dependency>
+            <groupId>org.mongodb</groupId>
+            <artifactId>mongo-java-driver</artifactId>
+            <version>${mongo-java-driver.version}</version>
+        </dependency>
+
+        <!-- all services are marked provided, because they get copied to the services directory -->
         <dependency>
             <groupId>com.redhat.thermostat</groupId>
             <artifactId>thermostat-web-gateway-service-jvm-byteman</artifactId>
--- a/services/commands/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/services/commands/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -124,11 +124,28 @@
     	<scope>provided</scope>
     </dependency>
 
+    <!-- JAX-RS Dependencies -->
+    <dependency>
+      <groupId>javax.ws.rs</groupId>
+      <artifactId>javax.ws.rs-api</artifactId>
+      <version>${javax-rs-api.version}</version>
+      <scope>provided</scope>
+    </dependency>
+
     <!-- Decoder/encoder deps -->
     <dependency>
         <groupId>com.google.code.gson</groupId>
         <artifactId>gson</artifactId>
         <version>${google-gson.version}</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <!-- Keycloak dependencies -->
+    <dependency>
+      <groupId>org.keycloak</groupId>
+      <artifactId>keycloak-core</artifactId>
+      <version>${keycloak.version}</version>
+      <scope>provided</scope>
     </dependency>
 
     <!-- test scoped deps -->
--- a/services/jcmd/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/services/jcmd/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -75,12 +75,15 @@
       <groupId>com.redhat.thermostat</groupId>
       <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
       <version>${project.version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>com.redhat.thermostat</groupId>
       <artifactId>thermostat-web-gateway-common-core</artifactId>
       <version>${project.version}</version>
+      <scope>provided</scope>
     </dependency>
+
     <!-- Servlet API deps -->
     <dependency>
       <groupId>javax.servlet</groupId>
--- a/services/jvm-byteman/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/services/jvm-byteman/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -73,8 +73,15 @@
     <!-- Thermostat Web Gateway Dependencies -->
     <dependency>
       <groupId>com.redhat.thermostat</groupId>
+      <artifactId>thermostat-web-gateway-common-core</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.redhat.thermostat</groupId>
       <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
       <version>${project.version}</version>
+      <scope>provided</scope>
     </dependency>
     
     <!-- Servlet API deps -->
--- a/services/jvm-compiler/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/services/jvm-compiler/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -59,6 +59,20 @@
     </properties>
 
     <dependencies>
+        <!-- Thermostat Web Gateway Dependencies -->
+        <dependency>
+            <groupId>com.redhat.thermostat</groupId>
+            <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.redhat.thermostat</groupId>
+            <artifactId>thermostat-web-gateway-common-core</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
         <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>javax.servlet-api</artifactId>
@@ -71,11 +85,6 @@
             <version>${javax-rs-api.version}</version>
             <scope>provided</scope>
         </dependency>
-        <dependency>
-            <groupId>com.redhat.thermostat</groupId>
-            <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
-            <version>1.99.12-SNAPSHOT</version>
-        </dependency>
     </dependencies>
 
     <build>
--- a/services/jvm-cpu/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/services/jvm-cpu/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -78,11 +78,13 @@
             <groupId>com.redhat.thermostat</groupId>
             <artifactId>thermostat-web-gateway-common-core</artifactId>
             <version>${project.version}</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>com.redhat.thermostat</groupId>
             <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
             <version>${project.version}</version>
+            <scope>provided</scope>
         </dependency>
 
         <!-- Servlet API deps -->
--- a/services/jvm-gc/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/services/jvm-gc/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -76,11 +76,13 @@
       <groupId>com.redhat.thermostat</groupId>
       <artifactId>thermostat-web-gateway-common-core</artifactId>
       <version>${project.version}</version>
+      <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>com.redhat.thermostat</groupId>
       <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
       <version>${project.version}</version>
+      <scope>provided</scope>
     </dependency>
     
     <!-- Servlet API deps -->
@@ -98,5 +100,13 @@
       <version>${javax-rs-api.version}</version>
       <scope>provided</scope>
     </dependency>
+
+    <!-- MongoDB driver -->
+    <dependency>
+      <groupId>org.mongodb</groupId>
+      <artifactId>mongo-java-driver</artifactId>
+      <version>${mongo-java-driver.version}</version>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
 </project>
--- a/services/jvm-io/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/services/jvm-io/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -75,6 +75,13 @@
       <groupId>com.redhat.thermostat</groupId>
       <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
       <version>${project.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.redhat.thermostat</groupId>
+      <artifactId>thermostat-web-gateway-common-core</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
     </dependency>
     
     <!-- Servlet API deps -->
--- a/services/jvm-memory/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/services/jvm-memory/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -75,6 +75,13 @@
       <groupId>com.redhat.thermostat</groupId>
       <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
       <version>${project.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.redhat.thermostat</groupId>
+      <artifactId>thermostat-web-gateway-common-core</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
     </dependency>
     
     <!-- Servlet API deps -->
--- a/services/jvms/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/services/jvms/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -76,6 +76,21 @@
       <groupId>com.redhat.thermostat</groupId>
       <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
       <version>${project.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.redhat.thermostat</groupId>
+      <artifactId>thermostat-web-gateway-common-core</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <!-- MongoDB driver -->
+    <dependency>
+      <groupId>org.mongodb</groupId>
+      <artifactId>mongo-java-driver</artifactId>
+      <version>${mongo-java-driver.version}</version>
+      <scope>provided</scope>
     </dependency>
 
     <!-- Servlet API Dependencies-->
--- a/services/system-cpu/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/services/system-cpu/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -76,6 +76,13 @@
             <groupId>com.redhat.thermostat</groupId>
             <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
             <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.redhat.thermostat</groupId>
+            <artifactId>thermostat-web-gateway-common-core</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
         </dependency>
 
         <!-- Servlet API deps -->
--- a/services/system-memory/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/services/system-memory/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -76,6 +76,13 @@
             <groupId>com.redhat.thermostat</groupId>
             <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
             <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.redhat.thermostat</groupId>
+            <artifactId>thermostat-web-gateway-common-core</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
         </dependency>
 
         <!-- Servlet API deps -->
--- a/services/system-network/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/services/system-network/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -76,6 +76,13 @@
             <groupId>com.redhat.thermostat</groupId>
             <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
             <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.redhat.thermostat</groupId>
+            <artifactId>thermostat-web-gateway-common-core</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
         </dependency>
 
         <!-- Servlet API deps -->
--- a/services/systems/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/services/systems/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -76,6 +76,13 @@
             <groupId>com.redhat.thermostat</groupId>
             <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
             <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.redhat.thermostat</groupId>
+            <artifactId>thermostat-web-gateway-common-core</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
         </dependency>
 
         <!-- Servlet API deps -->
--- a/tests/integration-tests/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/tests/integration-tests/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -136,6 +136,13 @@
             <version>${jetty.version}</version>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>${google-gson.version}</version>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 
 </project>
--- a/tests/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/tests/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -54,5 +54,6 @@
         <module>keycloak-integration-tests</module>
         <module>test-utils</module>
     </modules>
+
 </project>
 
--- a/tests/test-utils/pom.xml	Tue Oct 17 08:38:18 2017 -0400
+++ b/tests/test-utils/pom.xml	Tue Oct 17 08:49:58 2017 -0400
@@ -54,21 +54,36 @@
         <!-- Thermostat Web Gateway dependencies -->
         <dependency>
             <groupId>com.redhat.thermostat</groupId>
+            <artifactId>thermostat-web-gateway-common-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.redhat.thermostat</groupId>
             <artifactId>thermostat-web-gateway-common-mongodb</artifactId>
             <version>${project.version}</version>
         </dependency>
+
         <!-- MongoDB dependencies -->
         <dependency>
             <groupId>org.mongodb</groupId>
             <artifactId>mongo-java-driver</artifactId>
             <version>${mongo-java-driver.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>${google-gson.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
         <!-- HTTP test dependencies -->
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-client</artifactId>
             <version>${jetty.version}</version>
         </dependency>
+
         <!-- Test dependencies -->
         <dependency>
             <groupId>junit</groupId>