Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maven-parent: Copy locally defined OMODs #46

Merged
merged 4 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions distro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,23 @@
</goals>
</execution>

<execution>
<id>Remove non-OMODs from Modules</id>
<!-- Because we copy all dependencies, it's possible to get non-OMOD Jars in the openmrs_modules folder.
This job, run after "Rename JAR to OMOD" removes the non-OMODs -->
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete>
<fileset dir="${project.build.directory}/openmrs_modules" excludes="**/*.omod" />
</delete>
</target>
</configuration>
</execution>

<execution>
<id>Copy filtered OpenMRS configuration</id>
<phase>prepare-package</phase>
Expand Down
88 changes: 88 additions & 0 deletions maven-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@
<includeArtifactIds>ozone</includeArtifactIds>
</configuration>
</execution>

<execution>
<id>Copy OpenMRS modules to a temporary location</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeTransitive>true</excludeTransitive>
<useBaseVersion>true</useBaseVersion>
<outputDirectory>${project.build.directory}/openmrs_modules/</outputDirectory>
<!-- copying jars and omods only -->
<includeTypes>jar, omod</includeTypes>
</configuration>
</execution>
</executions>
</plugin>

Expand Down Expand Up @@ -180,6 +195,79 @@
</resources>
</configuration>
</execution>

<execution>
<!-- Copy OpenMRS modules -->
<id>Copy OpenMRS modules</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/${project.artifactId}-${project.version}/binaries/openmrs/modules</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${project.build.directory}/openmrs_modules</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>Determine if we need custom OMODs</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<condition property="custom.omods.available">
<available file="${project.build.directory}/openmrs_modules/*.jar" type="file" />
</condition>
</target>
</configuration>
</execution>

<execution>
<id>Rename JAR to OMOD</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target if="custom.omods.available">
<move todir="${project.build.directory}/openmrs_modules">
<fileset dir="${project.build.directory}/openmrs_modules" />
<mapper from="^(.+)-omod-(.+)\.jar" to="\1-\2.omod" type="regexp" />
</move>
</target>
</configuration>
</execution>

<execution>
<id>Remove non-OMODs from Modules</id>
<!-- Because we copy all dependencies, it's possible to get non-OMOD Jars in the openmrs_modules folder.
This job, run after "Rename JAR to OMOD" removes the non-OMODs -->
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target if="custom.omods.available">
<delete>
<fileset dir="${project.build.directory}/openmrs_modules" excludes="**/*.omod" />
</delete>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
Loading