Local build failure with openmrs core

Looking at Github Actions and CI, it looks green but when building the openmrs-core locally two tests are failing and from the logs seems like a class in the hibernate configuration named MedicationDispense isn’t found during the plan .

INFO] Running org.openmrs.api.MedicationDispenseServiceTest
[ERROR] Tests run: 14, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.649 s <<< FAILURE! - in org.openmrs.api.MedicationDispenseServiceTest
[ERROR] saveMedicationDispense_shouldUpdateExistingMedicationDispense  Time elapsed: 0.185 s  <<< ERROR!
org.openmrs.api.APIException: Couldn't find a class in the hibernate configuration named: org.openmrs.MedicationDispense
	at org.openmrs.api.MedicationDispenseServiceTest.saveMedicationDispense_shouldUpdateExistingMedicationDispense(MedicationDispenseServiceTest.java:173)

[ERROR] saveMedicationDispense_shouldSaveNewMedicationDispense  Time elapsed: 0.159 s  <<< ERROR!
org.openmrs.api.APIException: Couldn't find a class in the hibernate configuration named: org.openmrs.MedicationDispense
	at org.openmrs.api.MedicationDispenseServiceTest.saveMedicationDispense_shouldSaveNewMedicationDispense(MedicationDispenseServiceTest.java:160)

mvn -v command yields:

Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 1.8.0_312, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.13.0-30-generic", arch: "amd64", family: "unix

Try running these commands: mvn reset --hard and mvn clean -df then compile again.

Try running these commands: mvn reset --hard and mvn clean -df then compile again.

None of the commands succeed, the error thrown seems like maven does not have options of --hard and -df

Unable to parse command line options: Unrecognized option: --hard
Unable to parse command line options: Unrecognized option: -df

Sorry. That was a slip of the keyboard. Replace ‘mvn’ with ‘git’

The same error is thrown! Have given an attempt to deleting the local repo and cloned a fresh one but the same two tests are failing.

I see this too. Weirdly, targetting just the failing class, e.g., mvn test -Dtest=MedicationDispenseServiceTest causes the tests to run just fine.

Am failing to understand why the MedicationDispense class is failing to be found during the local build plan. Upstream(Actions and Bamboo) things are green.

This is true on my end as well.

@kdaud i have just made a followup commit on openmrs-core. Can you update and try again?

1 Like

This worketh for me :slightly_smiling_face:

The local build is happy now :grinning:.

@dkayiwa is MedicationDispense a special class that holds some metadata sources? and why was the build failing only on the local scale but upstream plans were green?