Juan Hernandez has uploaded a new change for review.

Change subject: packaging: Move dependencies to a JBoss module
......................................................................

packaging: Move dependencies to a JBoss module

Currently we package dependencies as .jar files in the lib directories
of the .ear and in the .war of RESTAPI. This has the inconvenient that
those dependencies don't have an associated artifact and also can't be
shared from different applications. This patch moves all those
dependencies to the dependencies jboss module, so that they are added to
the corresponding artifact, and can then be easily installed and shared.

Change-Id: I82a775915f4b2066ef14961cf69c2a35d0673133
Signed-off-by: Juan Hernandez <[email protected]>
---
M backend/manager/dependencies/pom.xml
A 
backend/manager/dependencies/src/main/modules/org/ovirt/engine/core/dependencies/main/module.xml
M backend/manager/modules/restapi/webapp/pom.xml
M ear/pom.xml
M ear/src/main/resources/META-INF/MANIFEST.MF
M packaging/fedora/spec/ovirt-engine.spec.in
6 files changed, 271 insertions(+), 109 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/11686/1

diff --git a/backend/manager/dependencies/pom.xml 
b/backend/manager/dependencies/pom.xml
index ce84a68..faf3148 100644
--- a/backend/manager/dependencies/pom.xml
+++ b/backend/manager/dependencies/pom.xml
@@ -22,6 +22,126 @@
   <dependencies>
 
     <dependency>
+      <groupId>commons-httpclient</groupId>
+      <artifactId>commons-httpclient</artifactId>
+      <version>${httpclient.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-compress</artifactId>
+      <version>${commons-compress.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.mina</groupId>
+      <artifactId>mina-core</artifactId>
+      <version>${mina-core.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.sshd</groupId>
+      <artifactId>sshd-core</artifactId>
+      <version>${sshd-core.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.ws.commons.util</groupId>
+      <artifactId>ws-commons-util</artifactId>
+      <version>1.0.2</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.xmlrpc</groupId>
+      <artifactId>xmlrpc-client</artifactId>
+      <version>${xmlrpc-client.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.xmlrpc</groupId>
+      <artifactId>xmlrpc-common</artifactId>
+      <version>${xmlrpc-client.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.ovirt.otopi</groupId>
+      <artifactId>otopi</artifactId>
+      <version>${otopi.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.ovirt.ovirt-host-deploy</groupId>
+      <artifactId>ovirt-host-deploy</artifactId>
+      <version>${ovirt-host-deploy.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.quartz-scheduler</groupId>
+      <artifactId>quartz</artifactId>
+      <version>${quartz.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>${slf4j-jdk14.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework.ldap</groupId>
+      <artifactId>spring-ldap-core</artifactId>
+      <version>${spring.ldap.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-aop</artifactId>
+      <version>${spring.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-beans</artifactId>
+      <version>${spring.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <version>${spring.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-core</artifactId>
+      <version>${spring.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-expression</artifactId>
+      <version>${spring.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-instrument</artifactId>
+      <version>${spring.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-jdbc</artifactId>
+      <version>${spring.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-tx</artifactId>
+      <version>${spring.version}</version>
+    </dependency>
+
+    <dependency>
       <groupId>postgresql</groupId>
       <artifactId>postgresql</artifactId>
       <version>${postgresql.version}</version>
@@ -67,6 +187,32 @@
                   from="${maven.project.dependencies.versions}" 
                   to="flatten" />
 
+                <!-- Copy the .jar files of the dependencies to the temporary
+                     modules directory: -->
+                <copy 
todir="${modules.directory}/org/ovirt/engine/core/dependencies/main">
+                  <fileset refid="commons-httpclient:commons-httpclient:jar"/>
+                  <fileset refid="org.apache.commons:commons-compress:jar"/>
+                  <fileset refid="org.apache.mina:mina-core:jar"/>
+                  <fileset refid="org.apache.sshd:sshd-core:jar"/>
+                  <fileset 
refid="org.apache.ws.commons.util:ws-commons-util:jar"/>
+                  <fileset refid="org.apache.xmlrpc:xmlrpc-client:jar"/>
+                  <fileset refid="org.apache.xmlrpc:xmlrpc-common:jar"/>
+                  <fileset refid="org.ovirt.otopi:otopi:jar"/>
+                  <fileset 
refid="org.ovirt.ovirt-host-deploy:ovirt-host-deploy:jar"/>
+                  <fileset refid="org.quartz-scheduler:quartz:jar"/>
+                  <fileset refid="org.slf4j:slf4j-api:jar"/>
+                  <fileset 
refid="org.springframework.ldap:spring-ldap-core:jar"/>
+                  <fileset refid="org.springframework:spring-aop:jar"/>
+                  <fileset refid="org.springframework:spring-beans:jar"/>
+                  <fileset refid="org.springframework:spring-context:jar"/>
+                  <fileset refid="org.springframework:spring-core:jar"/>
+                  <fileset refid="org.springframework:spring-expression:jar"/>
+                  <fileset refid="org.springframework:spring-instrument:jar"/>
+                  <fileset refid="org.springframework:spring-jdbc:jar"/>
+                  <fileset refid="org.springframework:spring-tx:jar"/>
+                  <mapper refid="clean.version"/>
+                </copy>
+
                 <!-- Copy the .jar file of the JDBC driver to the modules
                      directory: -->
                 <copy todir="${modules.directory}/org/postgresql/main">
diff --git 
a/backend/manager/dependencies/src/main/modules/org/ovirt/engine/core/dependencies/main/module.xml
 
b/backend/manager/dependencies/src/main/modules/org/ovirt/engine/core/dependencies/main/module.xml
new file mode 100644
index 0000000..3eb8e8b
--- /dev/null
+++ 
b/backend/manager/dependencies/src/main/modules/org/ovirt/engine/core/dependencies/main/module.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This module contains all the dependencies that are used by serveral
+     engine components and that are not available as builtin modules in
+     JBoss 7: -->
+
+<module xmlns="urn:jboss:module:1.0" name="org.ovirt.engine.core.dependencies">
+   <resources>
+     <resource-root path="commons-compress.jar"/>
+     <resource-root path="commons-httpclient.jar"/>
+     <resource-root path="mina-core.jar"/>
+     <resource-root path="otopi.jar"/>
+     <resource-root path="ovirt-host-deploy.jar"/>
+     <resource-root path="quartz.jar"/>
+     <resource-root path="slf4j-api.jar"/>
+     <resource-root path="spring-aop.jar"/>
+     <resource-root path="spring-beans.jar"/>
+     <resource-root path="spring-context.jar"/>
+     <resource-root path="spring-core.jar"/>
+     <resource-root path="spring-expression.jar"/>
+     <resource-root path="spring-instrument.jar"/>
+     <resource-root path="spring-jdbc.jar"/>
+     <resource-root path="spring-ldap-core.jar"/>
+     <resource-root path="spring-tx.jar"/>
+     <resource-root path="sshd-core.jar"/>
+     <resource-root path="ws-commons-util.jar"/>
+     <resource-root path="xmlrpc-client.jar"/>
+     <resource-root path="xmlrpc-common.jar"/>
+   </resources>
+
+   <dependencies>
+      <module name="asm.asm"/>
+      <module name="javax.api"/>
+      <module name="javax.transaction.api"/>
+      <module name="org.apache.commons.logging"/>
+   </dependencies>
+
+</module>
diff --git a/backend/manager/modules/restapi/webapp/pom.xml 
b/backend/manager/modules/restapi/webapp/pom.xml
index 40e48c0..f8f265f 100644
--- a/backend/manager/modules/restapi/webapp/pom.xml
+++ b/backend/manager/modules/restapi/webapp/pom.xml
@@ -33,16 +33,17 @@
       <plugin>
         <artifactId>maven-war-plugin</artifactId>
         <configuration>
-          <ejbVersion>2.1.1</ejbVersion>
-          <generateClient>true</generateClient>
-          <archive>
-            <manifest>
-              <addClasspath>false</addClasspath>
-            </manifest>
-            <manifestEntries>
-              <Dependencies>org.apache.log4j, 
org.jboss.resteasy.resteasy-jaxb-provider, org.jboss.resteasy.resteasy-jaxrs, 
org.jboss.resteasy.resteasy-jackson-provider, 
org.codehaus.jackson.jackson-mapper-asl, 
deployment.engine.ear.engine-bll.jar</Dependencies>
-            </manifestEntries>
-          </archive>
+
+          <!-- Don't include any of the external dependencies, as they are
+               already included as references in the manifest (note that the
+               web.xml file is included regardless of this configuration): -->
+          <packagingIncludes>
+            WEB-INF/lib/interface-common-jaxrs-*.jar,
+            WEB-INF/lib/restapi-definition-*.jar,
+            WEB-INF/lib/restapi-jaxrs-*.jar,
+            WEB-INF/lib/restapi-types-*.jar,
+          </packagingIncludes>
+
         </configuration>
       </plugin>
     </plugins>
diff --git a/ear/pom.xml b/ear/pom.xml
index 9747f5f..32171f9 100644
--- a/ear/pom.xml
+++ b/ear/pom.xml
@@ -233,6 +233,12 @@
               <bundleFileName>engine-vdsbroker.jar</bundleFileName>
             </jarModule>
 
+            <jarModule>
+              <groupId>org.ovirt.engine.core</groupId>
+              <artifactId>searchbackend</artifactId>
+              <bundleFileName>engine-searchbackend.jar</bundleFileName>
+            </jarModule>
+
             <!-- ** WARs -->
             <webModule>
               <groupId>org.ovirt.engine.core</groupId>
@@ -293,34 +299,26 @@
             
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
           </archive>
 
+          <!-- Add the META-INF directory, all the EJB and web
+               applications, and our own dependencies from the
+               lib directory, but none of the external dependencies,
+               as they are already included as references in the
+               manifest: -->
+          <packagingIncludes>
+            *.jar/**,
+            *.war/**,
+            META-INF/**,
+            lib/engine-common.jar/**,
+            lib/engine-compat.jar/**,
+            lib/engine-encryptutils.jar/**,
+            lib/engine-searchbackend.jar/**,
+            lib/engine-utils.jar/**,
+            lib/engine-vdsbroker.jar/**,
+          </packagingIncludes>
+
         </configuration>
       </plugin>
 
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>copy-quartz-jar</id>
-            <phase>package</phase>
-            <goals>
-              <goal>copy</goal>
-            </goals>
-            <configuration>
-              <artifactItems>
-                <artifactItem>
-                  <groupId>org.quartz-scheduler</groupId>
-                  <artifactId>quartz</artifactId>
-                  <version>${quartz.version}</version>
-                  <type>jar</type>
-                  <overWrite>true</overWrite>
-                  <destFileName>quartz-${quartz.version}.jar</destFileName>
-                  
<outputDirectory>${project.build.directory}/quartz</outputDirectory>
-                </artifactItem>
-              </artifactItems>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
     </plugins>
   </build>
 
diff --git a/ear/src/main/resources/META-INF/MANIFEST.MF 
b/ear/src/main/resources/META-INF/MANIFEST.MF
index c118c30..d004396 100644
--- a/ear/src/main/resources/META-INF/MANIFEST.MF
+++ b/ear/src/main/resources/META-INF/MANIFEST.MF
@@ -1,5 +1,13 @@
 Manifest-Version: 1.0
-Dependencies: org.apache.log4j,
- org.codehaus.jackson.jackson-core-asl,
- org.codehaus.jackson.jackson-mapper-asl
+Dependencies: asm.asm,
+ javax.validation.api,
+ org.apache.commons.beanutils,
+ org.apache.commons.codec,
+ org.apache.commons.collections,
+ org.apache.commons.lang,
+ org.apache.log4j,
+ org.codehaus.jackson.jackson-mapper-asl,
+ org.dom4j,
+ org.hibernate.validator,
+ org.ovirt.engine.core.dependencies
 
diff --git a/packaging/fedora/spec/ovirt-engine.spec.in 
b/packaging/fedora/spec/ovirt-engine.spec.in
index 4d91cb3..0689ec7 100644
--- a/packaging/fedora/spec/ovirt-engine.spec.in
+++ b/packaging/fedora/spec/ovirt-engine.spec.in
@@ -142,8 +142,6 @@
 Requires: bea-stax-api
 Requires: bind-utils
 Requires: cracklib-python
-Requires: geronimo-validation
-Requires: hibernate-validator
 Requires: httpd
 Requires: java-1.7.0-openjdk >= 1:1.7.0.9-2.3.3.2
 Requires: jakarta-commons-httpclient
@@ -398,66 +396,26 @@
 done
 %endif
 
-# Remove the jar files that are not needed:
-while read lib_path
+
+# Replace jar files in the ear with links to their actual locations:
+while read jar_name ear_path
 do
-  rm -rf %{buildroot}%{engine_ear}/lib/${lib_path}*.jar
+  rm -rf %{buildroot}%{engine_ear}/${ear_path}*.jar
+  ln -s %{engine_java}/${jar_name}.jar 
%{buildroot}%{engine_ear}/${ear_path}.jar
 done <<'.'
-activation
-antlr
-aopalliance
-c3p0
-ejb3-persistence
-jaxb-api
-jaxb-impl
-jboss-interceptors-api_1.1_spec
-stax-api
-xml-apis
+bll engine-bll
+common lib/engine-common
+dal lib/engine-dal
+engineencryptutils lib/engine-encryptutils
+scheduler engine-scheduler
+searchbackend lib/engine-searchbackend
+utils lib/utils
+vdsbroker lib/vdsbroker
 .
 
-# Attention!
-# spring-asm *IS* required on rhel-6
-rm -rf %{buildroot}%{engine_ear}/lib/spring-asm*.jar
 
-# Then for the system jar files (using build-classpath):
-while read jar_name lib_path
-do
-  rm -rf %{buildroot}%{engine_ear}/lib/${lib_path}*.jar
-  ln -s `build-classpath ${jar_name}` 
%{buildroot}%{engine_ear}/lib/${lib_path}.jar
-done <<'.'
-apache-mina/mina-core mina-core
-apache-sshd/sshd-core sshd-core
-commons-beanutils commons-beanutils
-commons-codec commons-codec
-commons-collections commons-collections
-commons-httpclient commons-httpclient
-commons-lang commons-lang
-commons-compress commons-compress
-dom4j dom4j
-geronimo-validation validation-api
-hibernate-validator hibernate-validator
-objectweb-asm/asm-all asm-all
-quartz quartz
-slf4j/api slf4j-api
-springframework/spring-aop spring-aop
-springframework/spring-beans spring-beans
-springframework/spring-context spring-context
-springframework/spring-core spring-core
-springframework/spring-expression spring-expression
-springframework/spring-instrument spring-instrument
-springframework/spring-jdbc spring-jdbc
-springframework/spring-tx spring-tx
-spring-ldap/spring-ldap-core spring-ldap-core
-ws-commons-util ws-commons-util
-xmlrpc3-client xmlrpc-client
-xmlrpc3-common xmlrpc-common
-otopi/otopi otopi
-ovirt-host-deploy/ovirt-host-deploy ovirt-host-deploy
-.
-
-# Replace jar files in the RESTAPI web application with links to ther
-# actual locations, first for jar files from this package, as for these
-# can't use build-classpath:
+# Replace jar files in the RESTAPI web application with links to their
+# actual locations:
 while read jar_name lib_path
 do
   rm -rf %{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}*.jar
@@ -469,22 +427,35 @@
 restapi-types restapi-types
 .
 
-# Remove the jar files that are not needed:
-while read lib_path
+# Replace jar files in the modules directory with links to their
+# actual locations:
+find %{buildroot}%{engine_jboss_modules} -type f -name "*.jar" -delete
+while read module_path jar_name jar_path
 do
-  rm -rf %{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}*.jar
+  rm -rf %{buildroot}%{engine_jboss_modules}/${module_path}/${jar_name}.jar
+  ln -s `build-classpath ${jar_path}` 
%{buildroot}%{engine_jboss_modules}/${module_path}/main/${jar_name}.jar
 done <<'.'
-commons-codec
-log4j
-.
-
-# Then for the system jar files (using build-classpath):
-while read jar_name lib_path
-do
-  rm -rf %{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}*.jar
-  ln -s `build-classpath ${jar_name}` 
%{buildroot}%{restapi_war}/WEB-INF/lib/${lib_path}.jar
-done <<'.'
-snakeyaml snakeyaml
+org/ovirt/engine/core/dependencies commons-compress commons-compress
+org/ovirt/engine/core/dependencies commons-httpclient commons-httpclient
+org/ovirt/engine/core/dependencies mina-core apache-mina/mina-core
+org/ovirt/engine/core/dependencies otopi otopi/otopi
+org/ovirt/engine/core/dependencies ovirt-host-deploy 
ovirt-host-deploy/ovirt-host-deploy
+org/ovirt/engine/core/dependencies quartz quartz
+org/ovirt/engine/core/dependencies slf4j-api slf4j/api
+org/ovirt/engine/core/dependencies spring-aop springframework/spring-aop
+org/ovirt/engine/core/dependencies spring-beans springframework/spring-beans
+org/ovirt/engine/core/dependencies spring-context 
springframework/spring-context
+org/ovirt/engine/core/dependencies spring-core springframework/spring-core
+org/ovirt/engine/core/dependencies spring-expression 
springframework/spring-expression
+org/ovirt/engine/core/dependencies spring-instrument 
springframework/spring-instrument
+org/ovirt/engine/core/dependencies spring-jdbc springframework/spring-jdbc
+org/ovirt/engine/core/dependencies spring-ldap-core 
spring-ldap/spring-ldap-core
+org/ovirt/engine/core/dependencies spring-tx springframework/spring-tx
+org/ovirt/engine/core/dependencies sshd-core apache-sshd/sshd-core
+org/ovirt/engine/core/dependencies ws-commons-util ws-commons-util
+org/ovirt/engine/core/dependencies xmlrpc-client xmlrpc3-client
+org/ovirt/engine/core/dependencies xmlrpc-common xmlrpc3-common
+org/postgresql postgresql postgresql-jdbc
 .
 
 # Install the systemd files:


--
To view, visit http://gerrit.ovirt.org/11686
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I82a775915f4b2066ef14961cf69c2a35d0673133
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to