Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
52 changes: 52 additions & 0 deletions .github/maven-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<profiles>
<profile>
<repositories>
<repository>
<id>openmrs-repo</id>
<name>OpenMRS Repository</name>
<url>https://mavenrepo.openmrs.org/public</url>
</repository>
<repository>
<releases>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<id>archetype</id>
<url>https://mavenrepo.openmrs.org/public</url>
</repository>
<repository>
<id>openmrs-repo-thirdparty</id>
<name>OpenMRS Thirdparty Nexus Repository</name>
<url>https://mavenrepo.openmrs.org/thirdparty</url>
</repository>
<repository>
<id>mks-nexus-public</id>
<name>Mekom Repository</name>
<url>https://nexus.mekomsolutions.net/repository/maven-public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>openmrs-repo</id>
<name>OpenMRS Nexus Repository</name>
<url>https://mavenrepo.openmrs.org/public</url>
</pluginRepository>
</pluginRepositories>
<id>openmrs</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>openmrs</activeProfile>
</activeProfiles>
<pluginGroups>
<pluginGroup>org.openmrs.maven.plugins</pluginGroup>
</pluginGroups>
</settings>
109 changes: 109 additions & 0 deletions .github/workflows/standalone-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Standalone 2.x Test CI

on:
push:
branches: [openmrs-emr2]
pull_request:
branches: [openmrs-emr2]

permissions:
contents: read

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
build-linux:
name: on Linux (Java 21)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Checkout openmrs-core
uses: actions/checkout@v4
with:
repository: openmrs/openmrs-core
ref: 2.8.x
path: openmrs-core
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this since for 2.8.x+ Snapshot artifacts are not published and cannot be pulled and built on CI this is a twist which later

 - name: Build and install openmrs-core
        run: |
          cd openmrs-core
          mvn clean install -DskipTests    

builds the repo like locally

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when we remove it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It results into

Downloaded from openmrs-repo: https://mavenrepo.openmrs.org/public/org/liquibase/liquibase-commercial/4.23.2/liquibase-commercial-4.23.2.pom (1.5 kB at 14 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for referenceapplication-standalone 2.6.0-SNAPSHOT:
[INFO] 
[INFO] referenceapplication-standalone .................... SUCCESS [ 21.971 s]
[INFO] referenceapplication-standalone-01 ................. FAILURE [ 17.403 s]
[INFO] referenceapplication-standalone-02 ................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  39.491 s
[INFO] Finished at: 2025-08-25T07:28:49Z
[INFO] ------------------------------------------------------------------------
Error:  Failed to execute goal org.liquibase:liquibase-maven-plugin:4.23.2:update (empty-database-create-schema) on project referenceapplication-standalone-01: Execution empty-database-create-schema of goal org.liquibase:liquibase-maven-plugin:4.23.2:update failed: Plugin org.liquibase:liquibase-maven-plugin:4.23.2 or one of its dependencies could not be resolved:
Error:  	Failed to read artifact descriptor for org.openmrs.api:openmrs-api:jar:2.8.1-SNAPSHOT
Error:  
Error:  -> [Help 1]
Error:  
Error:  To see the full stack trace of the errors, re-run Maven with the -e switch.
Error:  Re-run Maven using the -X switch to enable full debug logging.
Error:  
Error:  For more information about the errors and possible solutions, please read the following articles:
Error:  [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Error:  
Error:  After correcting the problems, you can resume the build with the command
Error:    mvn <args> -rf :referenceapplication-standalone-01

But only on CI and passes locally

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen when we need to use the 3.0.x branch?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically tried the master branch but as we talk now it points 3.0.0 version ... by using this am hoping for future develops this will require manual overide to point to the branch its building towards

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include that in the documentation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes let me add it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkayiwa Have updated it


- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Build and install openmrs-core
run: |
cd openmrs-core
mvn clean install -DskipTests
- name: Run Maven Clean
run: mvn clean --settings .github/maven-settings.xml

- name: Run Maven Install
run: mvn install --settings .github/maven-settings.xml

build-windows:
name: on Windows (Java 21)
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Checkout openmrs-core
uses: actions/checkout@v4
with:
repository: openmrs/openmrs-core
ref: 2.8.x
path: openmrs-core

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Build and install openmrs-core
run: |
cd openmrs-core
mvn clean install -DskipTests
- name: Run Maven Clean
run: mvn clean --settings .github/maven-settings.xml

- name: Run Maven Install
run: mvn install --settings .github/maven-settings.xml

build-macos:
name: on macOS (Java 21)
runs-on: macos-15
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Checkout openmrs-core
uses: actions/checkout@v4
with:
repository: openmrs/openmrs-core
ref: 2.8.x
path: openmrs-core

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Build and install openmrs-core
run: |
cd openmrs-core
mvn clean install -DskipTests
- name: Run Maven Clean
run: mvn clean --settings .github/maven-settings.xml

- name: Run Maven Install
run: mvn install --settings .github/maven-settings.xml
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,49 @@
-> output is in the target folder, as referenceapplkication-standalone-(refapp.version).zip
-> the contents of that zip are in the similarly-named folder under /target, if you want to test in-place

### Building with OpenMRS Core Snapshots

The **Reference Application Standalone 2.x** depends on **OpenMRS Core 2.8.x-SNAPSHOT** artifacts.
Since **snapshot artifacts are not published** to Maven Central or the OpenMRS public Maven repository, they must be **built and installed locally** before compiling the Standalone.

#### Local builds

If you are building locally, you need to install OpenMRS Core 2.8.x into your Maven cache first:

```bash
git clone https://github.com/openmrs/openmrs-core.git
cd openmrs-core
git checkout 2.8.x
mvn clean install -DskipTests
```

This makes the required `2.8.x-SNAPSHOT` artifacts available in your local `~/.m2/repository`.

#### CI builds

On CI (e.g., GitHub Actions), we explicitly build and install `openmrs-core` so that snapshot dependencies are resolved during the Standalone build:

```yaml
- name: Checkout openmrs-core
uses: actions/checkout@v4
with:
repository: openmrs/openmrs-core
ref: 2.8.x
path: openmrs-core

- name: Build and install openmrs-core
run: |
cd openmrs-core
mvn clean install -DskipTests
```
👉 This step ensures **snapshot versions are available during CI pipelines**, preventing build failures caused by missing `2.8.x-SNAPSHOT` artifacts.

#### Future updates

If the Standalone project upgrades to depend on a different OpenMRS Core branch (e.g., `3.0.x`), the CI workflow will need to be updated to build and install that matching snapshot version (e.g., `ref: 3.0.x`)..


## HOW TO RUN FROM ECLIPSE

- Copy your war file into the "tomcat/webapps" folder. Where the tomcat folder is at the root of the project.
Expand Down
3 changes: 2 additions & 1 deletion pom-step-02.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,14 @@
<executions>
<execution>
<id>package-jar-with-dependencies</id>
<phase>prepare-package</phase>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the phase?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helps the attaching not to temporarily treat it as a temporary build output

<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>openmrs-standalone</finalName>
<appendAssemblyId>false</appendAssemblyId>
<attach>true</attach>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we attaching?

Copy link
Member Author

@Muta-Jonathan Muta-Jonathan Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously i was facing

Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.4.1:jar (default-jar) on project referenceapplication-standalone-02: 
You have to use a classifier to attach supplemental artifacts to the project instead of replacing them.

Without attaching, Maven treats the assembly as a temporary build output, not an artifact, which breaks the build since it does not include openmrs-standalone.jar but attaching helps to treat it as the main artifact

<outputDirectory>${project.build.directory}</outputDirectory>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
Expand Down
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<liquibase.plugin.version>4.23.2</liquibase.plugin.version>

<tomcat.version>9.0.106</tomcat.version>
<openmrs.version>2.8.0-SNAPSHOT</openmrs.version>
<openmrs.version>2.8.1-SNAPSHOT</openmrs.version>
<refapp.version>2.14.0-SNAPSHOT</refapp.version>
<mariadb4jVersion>3.2.0</mariadb4jVersion>
<junitVersion>5.12.2</junitVersion>
Expand Down Expand Up @@ -156,22 +156,22 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0</version>
<version>3.6.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<version>3.14.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
Expand All @@ -188,12 +188,12 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<version>3.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<version>3.7.1</version>
</plugin>

<!--This plugin's configuration is used to store Eclipse m2e settings
Expand Down
Loading