Juan Hernandez has uploaded a new change for review. Change subject: core: Create artifact for PostgreSQL module ......................................................................
core: Create artifact for PostgreSQL module Currently we are deploying the PostgreSQL module using the "setup" profile, but we don't have an artifact for the required module. This patch reuses the module description that we had and uses it to build a new "dependencies" artifact that can then be easily installed. Change-Id: Iad7ee2264fde3badf7d242fe3a20874e1d24d6bf Signed-off-by: Juan Hernandez <juan.hernan...@redhat.com> --- M Makefile A backend/manager/dependencies/pom.xml R backend/manager/dependencies/src/main/modules/org/postgresql/main/module.xml M backend/manager/pom.xml M ear/pom.xml M packaging/fedora/spec/ovirt-engine.spec.in 6 files changed, 111 insertions(+), 36 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/85/11685/1 diff --git a/Makefile b/Makefile index 3e742eb..c940326 100644 --- a/Makefile +++ b/Makefile @@ -422,10 +422,9 @@ install_jboss_modules: @echo "*** Deploying JBoss modules" - # PostgreSQL driver: - install -dm 755 $(DESTDIR)$(PKG_JBOSS_MODULES)/org/postgresql/main - install -m 644 deployment/modules/org/postgresql/main/module.xml $(DESTDIR)$(PKG_JBOSS_MODULES)/org/postgresql/main/. - ln -s $(JAVA_DIR)/postgresql-jdbc.jar $(DESTDIR)$(PKG_JBOSS_MODULES)/org/postgresql/main/. + # Incompress and install the contents of the modules archive to + # the directory containing engine modules: + X=`find "$(MAVEN_OUTPUT_DIR)" -name "dependencies-$(APP_VERSION)*.zip"` && unzip "$$X" -d "$(DESTDIR)$(PKG_JBOSS_MODULES)" install_service: @echo "*** Deploying service" diff --git a/backend/manager/dependencies/pom.xml b/backend/manager/dependencies/pom.xml new file mode 100644 index 0000000..ce84a68 --- /dev/null +++ b/backend/manager/dependencies/pom.xml @@ -0,0 +1,99 @@ +<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/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.ovirt.engine.core</groupId> + <artifactId>manager</artifactId> + <version>3.3.0-SNAPSHOT</version> + </parent> + + <artifactId>dependencies</artifactId> + <packaging>pom</packaging> + + <name>oVirt Engine dependencies</name> + + <!-- We need to put here all the dependencies corresponding to the + .jar files that will be added to the modules archive: --> + + <dependencies> + + <dependency> + <groupId>postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>${postgresql.version}</version> + </dependency> + + </dependencies> + + <build> + + <plugins> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>dependencies</id> + <phase>package</phase> + <goals> + <goal>run</goal> + </goals> + <configuration> + <tasks> + + <!-- Create a temporary directory to store all the files + that will go into the modules archive: --> + <property name="modules.directory" value="${project.build.directory}/modules-${project.version}"/> + <mkdir dir="${modules.directory}"/> + + <!-- Copy all the module descriptors to the temporary + directory: --> + <copy todir="${modules.directory}"> + <fileset dir="${basedir}/src/main/modules"/> + </copy> + + <!-- Prepare the mapper that removes version numbers + from maven artifacts, as we will need it to generate + clean .jar file names inside the modules archive: --> + <dependencyfilesets/> + <mapper + id="clean.version" + classname="org.apache.maven.ant.tasks.support.VersionMapper" + from="${maven.project.dependencies.versions}" + to="flatten" /> + + <!-- Copy the .jar file of the JDBC driver to the modules + directory: --> + <copy todir="${modules.directory}/org/postgresql/main"> + <fileset refid="postgresql:postgresql:jar"/> + <mapper refid="clean.version"/> + </copy> + + <!-- Create the archive containing the module + descriptors and the .jar files of the dependencies: --> + <property name="modules.archive" value="${project.build.directory}/modules-${project.version}.zip"/> + <zip destfile="${modules.archive}"> + <fileset dir="${modules.directory}"/> + </zip> + + <!-- Attach the generated modules archive as an artifact + so that it will be available in the local repository + like any other artifact: --> + <attachartifact file="${modules.archive}" type="zip"/> + + </tasks> + </configuration> + </execution> + </executions> + </plugin> + + </plugins> + + </build> + +</project> diff --git a/deployment/modules/org/postgresql/main/module.xml b/backend/manager/dependencies/src/main/modules/org/postgresql/main/module.xml similarity index 83% rename from deployment/modules/org/postgresql/main/module.xml rename to backend/manager/dependencies/src/main/modules/org/postgresql/main/module.xml index 0912991..be37eb8 100644 --- a/deployment/modules/org/postgresql/main/module.xml +++ b/backend/manager/dependencies/src/main/modules/org/postgresql/main/module.xml @@ -2,7 +2,7 @@ <module xmlns="urn:jboss:module:1.0" name="org.postgresql"> <resources> - <resource-root path="postgresql-jdbc.jar"/> + <resource-root path="postgresql.jar"/> </resources> <dependencies> diff --git a/backend/manager/pom.xml b/backend/manager/pom.xml index 8963ea6..c79632a 100644 --- a/backend/manager/pom.xml +++ b/backend/manager/pom.xml @@ -14,5 +14,6 @@ <module>dbscripts</module> <module>modules</module> <module>tools</module> + <module>dependencies</module> </modules> </project> diff --git a/ear/pom.xml b/ear/pom.xml index ae63933..9747f5f 100644 --- a/ear/pom.xml +++ b/ear/pom.xml @@ -428,44 +428,26 @@ <goal>run</goal> </goals> </execution> - <execution> - <id>copy-module-changes</id> - <phase>install</phase> - <goals> - <goal>run</goal> - </goals> - <configuration> - <tasks> - <echo>*** Copying ${basedir}/../deployment/modules to ${jbossHome}/modules</echo> - <copy todir="${jbossHome}/modules" verbose="true" overwrite="true"> - <fileset dir="${basedir}/../deployment/modules"> - <include name="org/postgresql/**"/> - </fileset> - </copy> - </tasks> - </configuration> - </execution> </executions> </plugin> <plugin> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> - <id>copy-postgresql-jdbc-jar</id> + <id>dependencies</id> <phase>install</phase> <goals> - <goal>copy</goal> + <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> - <groupId>postgresql</groupId> - <artifactId>postgresql</artifactId> - <version>${postgres.jdbc.version}</version> - <type>jar</type> + <groupId>org.ovirt.engine.core</groupId> + <artifactId>dependencies</artifactId> + <version>${engine.version}</version> + <type>zip</type> <overWrite>true</overWrite> - <outputDirectory>${jbossHome}/modules/org/postgresql/main</outputDirectory> - <destFileName>postgresql-jdbc.jar</destFileName> + <outputDirectory>${jbossHome}/modules</outputDirectory> </artifactItem> </artifactItems> </configuration> diff --git a/packaging/fedora/spec/ovirt-engine.spec.in b/packaging/fedora/spec/ovirt-engine.spec.in index 4b8b98c..4d91cb3 100644 --- a/packaging/fedora/spec/ovirt-engine.spec.in +++ b/packaging/fedora/spec/ovirt-engine.spec.in @@ -487,12 +487,6 @@ snakeyaml snakeyaml . -# Copy the module definitions: -install -dm 755 %{buildroot}%{engine_jboss_modules} -cp -r deployment/modules/* %{buildroot}%{engine_jboss_modules} -find %{buildroot}%{engine_jboss_modules} -type d -exec chmod 755 {} \; -find %{buildroot}%{engine_jboss_modules} -type f -exec chmod 644 {} \; - # Install the systemd files: install -dm 755 %{buildroot}%{_unitdir} install -m 644 packaging/fedora/engine-service.systemd %{buildroot}%{_unitdir}/%{engine_name}.service -- To view, visit http://gerrit.ovirt.org/11685 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iad7ee2264fde3badf7d242fe3a20874e1d24d6bf Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <juan.hernan...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches