Custom Release builds
I am putting together a custom release module that can use the official webapp build so as to take advantage of the webapp signing - the idea is to hold customized archetypes in my local repo of various branches (based of a single master custom branch that holds the build configuration) for each practice I configure
I am also including some of the properties files
2 Questions:
1. Is the only reason during assembly of the release package - that you pull up the archetype.jar open it and extract the adls that it ensures no build mismatch. As opposes to just using a fileset include from the source?
2. Apart from
a) Reports
b) Archetypes
c) default.properties
Are there any other files that would suit this sort of packaging?
The idea is you download the official build and then my customization and the custom build will extract and overwrite the parts of the official build that require customization. This gets around thefact that custom build cannot use the webdav stuff due to app signing.
Re: Custom Release builds
1. If I understand your question, using a fileset would mean accessing the openvpms-archetypes module from the openvpms-release module using a relative path. While doable, this is not recommended:
2. I package OpenVPMS for a couple of sites that customise archetypes and styles. I use:
This uses an overlay. You need to ensure that you exclude the files you want to customise.
Customised files include the stylehsheets, messages, hibernate and log4j.properties, and the spring configuration files.
pom.xml - sample-archetype-package
<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"> <parent> <artifactId>sample-openvpms</artifactId> <groupId>com.sample</groupId> <version>1.9-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>sample-archetype-package</artifactId> <build> <resources> <resource> <directory>${basedir}/target/archetypes/openvpms-release-${project.version}/update/archetypes </directory> <includes> <include>**/*.adl</include> <include>**/*.xml</include> </includes> </resource> </resources> <plugins> <plugin> <!-- Use the dependency plugin to unpack the openvpms-release archetype and, sample-archetypes --> <!-- archetypes. Exclude those that are redefined in subsequent jars to avoid picking up --> <!-- the wrong ones. --> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>unpack archetypes</id> <phase>generate-resources</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>org.openvpms</groupId> <artifactId>openvpms-release</artifactId> <type>zip</type> <version>${project.version}</version> <outputDirectory>target/archetypes</outputDirectory> <includes>openvpms-release-${project.version}/update/archetypes/**</includes> <excludes> <!-- exclude archetypes redefined by Sample --> **/act.customerAppointment.adl **/actRelationship.patientClinicalEventItem.adl **/contact.phoneNumber.adl, **/lookup.visitReason.adl, **/lookup.visitReasonVeNom.adl, **/party.customerperson.adl, **/party.organisationLocation.adl, **/party.patientpet.adl, </excludes> </artifactItem> <artifactItem> <groupId>com.sample</groupId> <artifactId>sample-archetypes</artifactId> <version>${project.version}</version> <outputDirectory> target/archetypes/openvpms-release-${project.version}/update/archetypes </outputDirectory> <includes>**/*.adl</includes> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>com.sample</groupId> <artifactId>sample-archetypes</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.openvpms</groupId> <artifactId>openvpms-archetypes</artifactId> </dependency> </dependencies> </project>
pom.xml - sample-web-app
<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"> <parent> <artifactId>sample-openvpms</artifactId> <groupId>com.sample</groupId> <version>1.9-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>sample-web-app</artifactId> <packaging>war</packaging> <name>OpenVPMS Web App</name> <build> <finalName>openvpms</finalName> <resources> <resource> <directory>${basedir}/src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.stylesheet</include> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> </resources> <plugins> <!-- copy the openvpms war package --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>unpack</id> <phase>generate-sources</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>org.openvpms</groupId> <artifactId>openvpms-web-app</artifactId> <version>${project.version}</version> <type>war</type> <overWrite>false</overWrite> <outputDirectory>${project.build.directory}/webapp</outputDirectory> <excludes> WEB-INF/*.xml, WEB-INF/lib/**, WEB-INF/classes/hibernate.properties, WEB-INF/classes/localisation/messages.properties, WEB-INF/classes/log4j.properties, WEB-INF/classes/style/default.stylesheet, login.jsp </excludes> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> <plugin> <!-- copy webapp for tomcat plugin --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <executions> <execution> <id>webapp</id> <phase>generate-resources</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target/webapp</outputDirectory> <resources> <resource> <directory>${basedir}/src/main/webapp/</directory> </resource> </resources> </configuration> </execution> <execution> <id>copy log4j properties</id> <phase>generate-resources</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target/webapp/WEB-INF/classes</outputDirectory> <resources> <resource> <directory>${basedir}/src/main/resources</directory> <includes> <include>log4j.properties</include> </includes> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <archive> <addMavenDescriptor>false</addMavenDescriptor> </archive> <overlays> <overlay> <groupId>org.openvpms</groupId> <artifactId>openvpms-web-app</artifactId> <type>war</type> <excludes> <exclude>WEB-INF/*.xml</exclude> <exclude>WEB-INF/classes/hibernate.properties</exclude> <exclude>WEB-INF/classes/localisation/messages.properties</exclude> <exclude>WEB-INF/classes/log4j.properties</exclude> <exclude>WEB-INF/classes/QueryFactory.properties</exclude> <exclude>WEB-INF/classes/style/default.stylesheet</exclude> <exclude>login.jsp</exclude> </excludes> </overlay> </overlays> </configuration> </plugin> <plugin> <artifactId>maven-source-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <server>openvpms-tomcat</server> <!--port>${maven.tomcat.port}</port--> <path>/${project.build.finalName}</path> <warSourceDirectory>${basedir}/target/webapp</warSourceDirectory> </configuration> <dependencies> <dependency> <groupId>${jdbc.groupId}</groupId> <artifactId>${jdbc.artifactId}</artifactId> <version>${jdbc.version}</version> </dependency> </dependencies> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.openvpms</groupId> <artifactId>openvpms-web-app</artifactId> <version>${project.version}</version> <type>war</type> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <scope>provided</scope> </dependency> </dependencies> </project>
pom.xml - sample-openvpms-package
<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"> <parent> <artifactId>sample-openvpms</artifactId> <groupId>com.sample</groupId> <version>1.9-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>sample-openvpms-package</artifactId> <packaging>pom</packaging> <name>Sample OpenVPMS Release</name> <description>The Sample OpenVPMS Release Distribution </description> <dependencies> <dependency> <groupId>com.sample</groupId> <artifactId>sample-archetype-package</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>com.sample</groupId> <artifactId>sample-web-app</artifactId> <type>war</type> <version>${project.version}</version> </dependency> <dependency> <groupId>org.openvpms</groupId> <artifactId>openvpms-framework</artifactId> </dependency> <dependency> <groupId>org.openvpms</groupId> <artifactId>openvpms-archetypes</artifactId> </dependency> <dependency> <groupId>org.openvpms</groupId> <artifactId>openvpms-reports</artifactId> </dependency> <dependency> <groupId>org.openvpms</groupId> <artifactId>openvpms-sms</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.openvpms</groupId> <artifactId>openvpms-etl-load</artifactId> </dependency> <dependency> <groupId>org.openvpms</groupId> <artifactId>openvpms-etl-plugin</artifactId> <version>${project.version}</version> <type>zip</type> </dependency> <dependency> <groupId>${jdbc.groupId}</groupId> <artifactId>${jdbc.artifactId}</artifactId> <version>${jdbc.version}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> </plugin> <plugin> <!-- use the dependency plugin to unpack the openvpms and sample archetypes --> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>unpack archetypes</id> <phase>test-compile</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>com.sample</groupId> <artifactId>sample-archetype-package</artifactId> <version>${project.version}</version> <outputDirectory>target/archetypes</outputDirectory> <includes>**/*.xml,**/*.adl</includes> <excludes>META-INF/**</excludes> </artifactItem> </artifactItems> </configuration> </execution> <execution> <id>unpack release</id> <phase>test-compile</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>org.openvpms</groupId> <artifactId>openvpms-release</artifactId> <type>zip</type> <version>${project.version}</version> <outputDirectory>target/staging/</outputDirectory> <includes>openvpms-release-${project.version}/conf/**, openvpms-release-${project.version}/bin/**, openvpms-release-${project.version}/db/createdb.sql, openvpms-release-${project.version}/update/db/**, openvpms-release-${project.version}/import/**, openvpms-release-${project.version}/images/**, openvpms-release-${project.version}/reports/**, openvpms-release-${project.version}/LICENSE.txt, openvpms-release-${project.version}/readme.txt </includes> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-resources-plugin</artifactId> <executions> <execution> <id>generate-hibernate-cfg</id> <phase>process-resources</phase> <goals> <goal>resources</goal> </goals> </execution> </executions> </plugin> <plugin> <!-- drop and create the openvpms database --> <groupId>org.codehaus.mojo</groupId> <artifactId>sql-maven-plugin</artifactId> <version>1.1</version> <dependencies> <dependency> <groupId>${jdbc.groupId}</groupId> <artifactId>${jdbc.artifactId}</artifactId> <version>${jdbc.version}</version> </dependency> </dependencies> <!-- common configuration shared by all executions --> <configuration> <driver>${build.jdbc.driverClassName}</driver> <url>${build.jdbc.server}</url> <username>${jdbc.admin.username}</username> <password>${jdbc.admin.password}</password> </configuration> <executions> <execution> <id>drop-db</id> <phase>test-compile</phase> <goals> <goal>execute</goal> </goals> <configuration> <autocommit>true</autocommit> <sqlCommand>drop database `${build.jdbc.db}`</sqlCommand> <!-- ignore error when database is not available --> <onError>continue</onError> </configuration> </execution> <execution> <id>create-db</id> <phase>test-compile</phase> <goals> <goal>execute</goal> </goals> <configuration> <sqlCommand>create database `${build.jdbc.db}`</sqlCommand> <keepFormat>true</keepFormat> </configuration> </execution> </executions> </plugin> <plugin> <!-- generate the database schema --> <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <version>2.2</version> <configuration> <componentProperties> <jdk5>true</jdk5> <configurationfile>target/classes/hibernate.cfg.xml</configurationfile> </componentProperties> </configuration> <executions> <execution> <phase>test</phase> <goals> <goal>hbm2ddl</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>${jdbc.groupId}</groupId> <artifactId>${jdbc.artifactId}</artifactId> <version>${jdbc.version}</version> </dependency> </dependencies> </plugin> <plugin> <!-- load archetypes --> <groupId>org.openvpms</groupId> <artifactId>openvpms-archetype-maven-plugin</artifactId> <version>${project.version}</version> <configuration> <dir>target/archetypes</dir> <assertionTypes> target/archetypes/org/openvpms/archetype/assertionTypes.xml </assertionTypes> <dialect>${build.hibernate.dialect}</dialect> <driver>${build.jdbc.driverClassName}</driver> <url>${build.jdbc.url}</url> <username>${build.jdbc.username}</username> <password>${build.jdbc.password}</password> </configuration> <executions> <execution> <phase>test</phase> <goals> <goal>load</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>${jdbc.groupId}</groupId> <artifactId>${jdbc.artifactId}</artifactId> <version>${jdbc.version}</version> </dependency> </dependencies> </plugin> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.2</version> <configuration> <tasks> <echo message="Dumping database"/> <!-- todo - need alternative dump for other databases --> <mkdir dir="target/db"/> <exec executable="mysqldump" output="target/db/db.sql" failOnError="true" logError="true"> <arg line="${build.jdbc.db} -u ${jdbc.admin.username} --password=${jdbc.admin.password}"/> </exec> </tasks> </configuration> <executions> <execution> <phase>test</phase> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> <plugin> <!-- build the release zip --> <artifactId>maven-assembly-plugin</artifactId> <configuration> <appendAssemblyId>false</appendAssemblyId> <descriptors> <descriptor>src/main/assembly/assembly.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> <resources> <resource> <directory>${basedir}/src/main/resources/hibernate</directory> <filtering>true</filtering> </resource> </resources> </build> <properties> <jdbc.admin.username>root</jdbc.admin.username> <jdbc.admin.password>root</jdbc.admin.password> </properties> </project>
Re: Custom Release builds
actually I was using it out of
../openvpms-archetypes/src/archetypes/**/*.adl
But yes the version mismatch was my concern.
The problem with your method is it will only work for someone with the original Web app package that has the signed jars in it already.. Basically you use the unpacked build and repackage it which is fine if the jars are signed.
For me I need to take a distribution package and then append to it. This is to ensure jar signing does not cause client grief.
Re: Custom Release builds
The other thing I was going to say is that maven assembly wont over write files so rather than excluding your modified adls from the original package just copy your modified ones in first. They wont be overwritten by default.
Re: Custom Release builds
I got burnt doing something like this. I don't recall if it was the dependency or assembly plugin, but one of them will overwrite if the second file is newer.
Re: Custom Release builds
This can be done by adding a dependency on the official build. As there are no 1.9 snapshots at repository.openvpms.org, you can grab one of the snapshot releases, extract it, and deploy whatever you need to your local repository. e.g.: