Skip to content

Commit

Permalink
OZ-196: Provide parent POMs to ease inheritance in child distros (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibacher authored Jan 19, 2024
1 parent eaec11c commit eb2a69a
Show file tree
Hide file tree
Showing 5 changed files with 376 additions and 76 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ buildNumber.properties
.project
.settings/
.vscode/
.idea/

# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
!/.mvn/wrapper/maven-wrapper.jar
78 changes: 10 additions & 68 deletions distro/pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<project>

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.ozonehis</groupId>
<artifactId>ozone-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../ozone-parent</relativePath>
</parent>

<groupId>com.ozonehis</groupId>
<artifactId>ozone-distro</artifactId>
<name>Ozone Distro</name>
<name>Ozone Distribution</name>
<description></description>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
Expand Down Expand Up @@ -91,7 +98,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>Copy Odoo Initializer add-on</id>
Expand All @@ -101,7 +107,6 @@
</goals>
<configuration>
<excludeTransitive>true</excludeTransitive>
<useBaseVersion>true</useBaseVersion>
<outputDirectory>
${project.build.directory}/${project.artifactId}-${project.version}/binaries/odoo/addons</outputDirectory>
<includeArtifactIds>odoo_initializer</includeArtifactIds>
Expand Down Expand Up @@ -131,7 +136,6 @@
</goals>
<configuration>
<excludeTransitive>true</excludeTransitive>
<useBaseVersion>true</useBaseVersion>
<outputDirectory>${project.build.directory}/${eipOpenMRSSenaiteArtifactId}</outputDirectory>
<includeArtifactIds>${eipOpenMRSSenaiteArtifactId}</includeArtifactIds>
</configuration>
Expand All @@ -145,7 +149,6 @@
</goals>
<configuration>
<excludeTransitive>true</excludeTransitive>
<useBaseVersion>true</useBaseVersion>
<outputDirectory>${project.build.directory}/${eipOdooOpenMRSArtifactId}</outputDirectory>
<includeArtifactIds>${eipOdooOpenMRSArtifactId}</includeArtifactIds>
</configuration>
Expand All @@ -159,7 +162,6 @@
</goals>
<configuration>
<excludeTransitive>true</excludeTransitive>
<useBaseVersion>true</useBaseVersion>
<outputDirectory>${project.build.directory}/referenceapplication-distro</outputDirectory>
<includeArtifactIds>referenceapplication-distro</includeArtifactIds>
</configuration>
Expand All @@ -171,7 +173,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<!-- Copy binaries/ folder -->
Expand Down Expand Up @@ -316,7 +317,6 @@

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>Rename JAR to OMOD</id>
Expand Down Expand Up @@ -412,10 +412,9 @@
<plugin>
<groupId>net.mekomsolutions.maven.plugin</groupId>
<artifactId>dependency-tracker-maven-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<executions>
<execution>
<id>Complile dependency report</id>
<id>Compile dependency report</id>
<phase>compile</phase>
<goals>
<goal>track</goal>
Expand All @@ -428,7 +427,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>Attach the dependency report</id>
Expand All @@ -453,62 +451,6 @@
</plugins>
</build>

<repositories>
<repository>
<id>mks-nexus-public</id>
<url>https://nexus.mekomsolutions.net/repository/maven-public/</url>
</repository>
<repository>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>https://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
</repository>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>https://mavenrepo.openmrs.org/nexus/content/repositories/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>openmrs-snapshots</id>
<name>OpenMRS Public Repository</name>
<url>https://mavenrepo.openmrs.org/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>mks-nexus-public</id>
<url>https://nexus.mekomsolutions.net/repository/maven-public/</url>
</pluginRepository>
<pluginRepository>
<id>mks-nexus-snapshots</id>
<url>https://nexus.mekomsolutions.net/repository/maven-snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

<profiles>
<profile>
<id>validator</id>
Expand Down
225 changes: 225 additions & 0 deletions ozone-distro-parent/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>

<parent>
<groupId>com.ozonehis</groupId>
<artifactId>ozone-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../ozone-parent</relativePath>
</parent>

<groupId>com.ozonehis</groupId>
<artifactId>ozone-distro-parent</artifactId>
<name>Ozone Distribution Parent</name>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<description>Parent project for Ozone distributions</description>

<organization>
<name>Ozone HIS</name>
<url>https://www.ozone-his.com</url>
</organization>

<developers>
<developer>
<name>Mekom Solutions</name>
<url>https://www.mekomsolutions.com</url>
</developer>
</developers>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ozone.version>1.0.0-SNAPSHOT</ozone.version>
</properties>

<dependencies>
<dependency>
<groupId>com.ozonehis</groupId>
<artifactId>ozone</artifactId>
<type>zip</type>
<version>${ozone.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Unpack Ozone zip -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>Unpack Ozone</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludeTransitive>true</excludeTransitive>
<outputDirectory>${project.build.directory}/ozone</outputDirectory>
<includeArtifactIds>ozone</includeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<!-- Copy and substitute some helper files (for demo and Gitpod) -->
<id>Copy and substitute some helper files</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${project.basedir}/.mvn</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>mvnw</include>
<include>mvnw.cmd</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>${project.basedir}/scripts</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>${project.basedir}/scripts</directory>
<includes>
<include>*.sh</include>
</includes>
<excludes>
<exclude>start-ozone.sh</exclude>
</excludes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>

<execution>
<!-- Copy the docker-compose-files.txt file to set the services to run -->
<id>Copy docker-compose-files.txt</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/${project.artifactId}-${project.version}/run/docker/scripts</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${project.basedir}/scripts</directory>
<includes>
<include>docker-compose-files.txt</include>
<include>start-ozone.sh</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>

<execution>
<!-- Override with local config files-->
<id>Copy local resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/${project.artifactId}-${project.version}/distro/configs</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${project.parent.basedir}/configs</directory>
<excludes>
<exclude>.gitkeep</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>

<execution>
<!-- Exclude files from Ozone -->
<id>Exclude unneeded Ozone files</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/${project.artifactId}-${project.version}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${project.build.directory}/ozone</directory>
<excludes>
<exclude>distro/**/addresshierarchy/*.*</exclude>
<exclude>distro/**/ampathforms/*.json</exclude>
<exclude>distro/**/ampathformstranslations/*.json</exclude>
<exclude>distro/**/globalproperties/i18n.xml</exclude>
<exclude>distro/**/*demo.*</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>validator</id>
<activation>
<property>
<name>env.CI</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>

<!-- hooking the OpenMRS config validation to the integration-test phase -->
<plugin>
<groupId>org.openmrs.maven.plugins</groupId>
<artifactId>openmrs-packager-maven-plugin</artifactId>
<executions>
<execution>
<id>Validate OpenMRS configuration</id>
<phase>integration-test</phase>
<goals>
<goal>validate-configurations</goal>
</goals>
<configuration>
<sourceDir>${project.build.directory}/${project.artifactId}-${project.version}/distro/configs/openmrs/initializer_config</sourceDir>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>
</profile>
</profiles>

</project>
Loading

0 comments on commit eb2a69a

Please sign in to comment.