Making Patient Flag module compatible with current Platform

Currently, the Patient Flags Module is designed to work with OpenMRS (Platform) 1.6.x, which is not used anymore.

As discussed in the Dev meeting on 2016-03-03 notes here, it was suggested that we modify the pom.xml file in the module to 1.9.x and try to get this module to run with 1.9.x (x is to be specified, ofcourse)

Since the current standalone version for 1.9.x is 1.9.10, it would seem natural that we could get this to work on the same. So I went ahead and modified the pom.xml version to 1.9.10, and then ran mvn clean install. However, the build fails due to a series of error. @mogoodrich, @darius here is the modified pom.xml file and the attached error log.

  1. Modified pom.xml:

http://pastebin.com/stNgDhK3

  1. Error log:

http://pastebin.com/bJK86Dt9

Hoping for some discussion and a fix soon :slightly_smiling:

These are compiler errors which you should be able to deal with one by one.

Right but why does 1.6.0 build just fine?

Thanks to @dkayiwa’s help, I was able to partially resolve the issue. It seems that annotations were being used differently in java 7 so I had to switch to JDK 6. Also, I had to add junit to the classpath. That fixed the junit part in the error log.

The only error remaining is

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project patientflags-omod: Compilation failure: Compilation fai
lure:
[ERROR] /E:/OpenMRS/openmrs-module-patientflags/omod/src/test/java/org/openmrs/module/patientflags/FlagTest.java:[29,24] package org.openmrs.test does not exist
[ERROR] /E:/OpenMRS/openmrs-module-patientflags/omod/src/test/java/org/openmrs/module/patientflags/FlagTest.java:[32,31] cannot find symbol
[ERROR] symbol: class BaseModuleContextSensitiveTest
[ERROR] /E:/OpenMRS/openmrs-module-patientflags/omod/src/test/java/org/openmrs/module/patientflags/FlagServiceTest.java:[12,24] package org.openmrs.test does not exist
[ERROR] /E:/OpenMRS/openmrs-module-patientflags/omod/src/test/java/org/openmrs/module/patientflags/FlagServiceTest.java:[18,38] cannot find symbol
[ERROR] symbol: class BaseModuleContextSensitiveTest
[ERROR] /E:/OpenMRS/openmrs-module-patientflags/omod/src/test/java/org/openmrs/module/patientflags/FlagTest.java:[49,17] cannot find symbol
[ERROR] symbol:   method initializeInMemoryDatabase()
[ERROR] location: class org.openmrs.module.patientflags.FlagTest
[ERROR] /E:/OpenMRS/openmrs-module-patientflags/omod/src/test/java/org/openmrs/module/patientflags/FlagTest.java:[50,17] cannot find symbol
[ERROR] symbol:   method executeDataSet(java.lang.String)
[ERROR] location: class org.openmrs.module.patientflags.FlagTest
[ERROR] /E:/OpenMRS/openmrs-module-patientflags/omod/src/test/java/org/openmrs/module/patientflags/FlagTest.java:[51,17] cannot find symbol
[ERROR] symbol:   method authenticate()
[ERROR] location: class org.openmrs.module.patientflags.FlagTest
[ERROR] /E:/OpenMRS/openmrs-module-patientflags/omod/src/test/java/org/openmrs/module/patientflags/FlagTest.java:[229,48] cannot find symbol
[ERROR] symbol:   method getClass()
[ERROR] location: class org.openmrs.module.patientflags.FlagTest

It seems that BaseModuleContextSensitiveTest class is not being recognized. Also, the org.openmrs.test package does not exist. Am I supposed to be adding a maven dependency/changing my maven version maybe? Thanks @mogoodrich, @dkayiwa any clues. I have tried the ‘add dependency’ option from within the IDE but doesn’t work.

These are clearly classloading issues, you need to pick an openmrs version to support and make sure the necessary dependencies are set up well in all the pom files. Just out of curiosity, @bholagabbar why is this of high priority to work on? Is there an implementation that’s is requesting for this change?

@wyclif Yes I plan to work on this as one of the GSoC project. Unfortunately, I’m unable to resolve this ONE error. It’s definitely a dependency issue. I’ve added the entire openmrs.test.* dependency files in the `pom.xml’ but the issue still persists. I’ll post a more detailed and clear version of the issue being faced by me after resolving the ‘Junit’ thing.

@bholagabbar taking a look at the main Patient Flags pom (which I haven’t looked at in a few years :slight_smile: ) I see that I did set it up to build against different versions of OpenMRS (specifically version 1.6.x to 1.10.x)

You can try to run against a different version using the appropriate profile:

mvn clean install -Popenmrs-1.10 or mvn clean install -Popenmrs-1.9

You can see the different profiles in the pom.xml – basically what they do is overwrite certain variables defined in the pom, like openMRSVersion. The OpenMRS-1.9 version actually build for me, even when I switched to build against the 1.9.10 version of OpenMRS, so I don’t know if there is something else going wrong for you.

Mark

1 Like

Thanks a lot for the help @mogoodrich. Actually the correct command happens to be mvn clean install -P openmrs-1.10.0. I’m sure that must have been a typo. I got this command to build successfully after playing around with it a but :slightly_smiling:

I’ll build the 1.10.0 .war and deploy the module and let you know how it works out :smiley:

Actually, the profiles are “openmrs-1.10” and “openmrs-1.9” so I don’t think “openmrs-1.10.0” is correct–the problem is if the profile doesn’t exist, it will just ignore it (so “mvn clean install -P openmrs-1.10.0” would just do “mvn clean install”–ie, build against 1.6, which would work, but not do what you really wanted).

1 Like

@mogoodrich Oh alright thanks! I did what you said and 1.9 compiled just fine. So no blocker as such now.

However, there’s a build error with 1.10. I’m pretty sure this isn’t just me (i hope!) because I setup most of the dysfunctional stuff all over from scratch. Here 's the log:

PS E:\Openmrs\openmrs-module-patientflags> mvn clean install -P openmrs-1.10
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=256m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Patient Flags Module
[INFO] Patient Flags Module API
[INFO] Patient Flags Module OMOD
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Patient Flags Module 1.3.5-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ patientflags ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ patientflags ---
[INFO] Installing E:\Openmrs\openmrs-module-patientflags\pom.xml to C:\Users\User\.m2\repository\org\openmrs\module\pati
entflags\1.3.5-SNAPSHOT\patientflags-1.3.5-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Patient Flags Module API 1.3.5-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/api/openmrs-api/1.10.0-SNAPSHOT/
maven-metadata.xml
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/api/openmrs-api/1.10.0-SNAPSHOT/
openmrs-api-1.10.0-SNAPSHOT.pom
[WARNING] The POM for org.openmrs.api:openmrs-api:jar:1.10.0-SNAPSHOT is missing, no dependency information available
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/web/openmrs-web/1.10.0-SNAPSHOT/
maven-metadata.xml
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/web/openmrs-web/1.10.0-SNAPSHOT/
openmrs-web-1.10.0-SNAPSHOT.pom
[WARNING] The POM for org.openmrs.web:openmrs-web:jar:1.10.0-SNAPSHOT is missing, no dependency information available
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/codehaus/groovy/groovy/1.7.6/groovy-1.7.
6.pom
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/codehaus/groovy/groovy/1.7.6/groovy-1.7.6
.pom (29 KB at 19.9 KB/sec)
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm/3.2/asm-3.2.pom
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm/3.2/asm-3.2.pom (264 B at 0.4 KB/sec)

Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-parent/3.2/asm-parent-3.2.pom
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-parent/3.2/asm-parent-3.2.pom (5 KB a
t 6.1 KB/sec)
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-commons/3.2/asm-commons-3.2.pom
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-commons/3.2/asm-commons-3.2.pom (415
B at 0.6 KB/sec)
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-tree/3.2/asm-tree-3.2.pom
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-tree/3.2/asm-tree-3.2.pom (404 B at 0
.6 KB/sec)
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-util/3.2/asm-util-3.2.pom
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-util/3.2/asm-util-3.2.pom (409 B at 0
.5 KB/sec)
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-analysis/3.2/asm-analysis-3.2.pom
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-analysis/3.2/asm-analysis-3.2.pom (41
7 B at 0.6 KB/sec)
[WARNING] The POM for org.openmrs.api:openmrs-api:jar:tests:1.10.0-SNAPSHOT is missing, no dependency information availa
ble
[WARNING] The POM for org.openmrs.web:openmrs-web:jar:tests:1.10.0-SNAPSHOT is missing, no dependency information availa
ble
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/test/openmrs-test/1.10.0-SNAPSHO
T/maven-metadata.xml
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/test/openmrs-test/1.10.0-SNAPSHO
T/openmrs-test-1.10.0-SNAPSHOT.pom
[WARNING] The POM for org.openmrs.test:openmrs-test:pom:1.10.0-SNAPSHOT is missing, no dependency information available
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/api/openmrs-api/1.10.0-SNAPSHOT/
openmrs-api-1.10.0-SNAPSHOT.jar
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/web/openmrs-web/1.10.0-SNAPSHOT/
openmrs-web-1.10.0-SNAPSHOT.jar
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-commons/3.2/asm-commons-3.2.jar
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/codehaus/groovy/groovy/1.7.6/groovy-1.7.
6.jar
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm/3.2/asm-3.2.jar
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-util/3.2/asm-util-3.2.jar
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-analysis/3.2/asm-analysis-3.2.jar
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-commons/3.2/asm-commons-3.2.jar (33 K
B at 18.6 KB/sec)
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-tree/3.2/asm-tree-3.2.jar
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm/3.2/asm-3.2.jar (43 KB at 21.1 KB/sec
)
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/api/openmrs-api/1.10.0-SNAPSHOT/
openmrs-api-1.10.0-SNAPSHOT-tests.jar
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/web/openmrs-web/1.10.0-SNAPSHOT/
openmrs-web-1.10.0-SNAPSHOT-tests.jar
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-util/3.2/asm-util-3.2.jar (36 KB at 1
4.4 KB/sec)
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-analysis/3.2/asm-analysis-3.2.jar (18
 KB at 7.1 KB/sec)
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/asm/asm-tree/3.2/asm-tree-3.2.jar (22 KB at 7
.8 KB/sec)
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/codehaus/groovy/groovy/1.7.6/groovy-1.7.6
.jar (4921 KB at 105.7 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Patient Flags Module ............................... SUCCESS [  0.265 s]
[INFO] Patient Flags Module API ........................... FAILURE [ 57.402 s]
[INFO] Patient Flags Module OMOD .......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 58.130 s
[INFO] Finished at: 2016-03-05T01:28:45+05:30
[INFO] Final Memory: 13M/619M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project patientflags-api: Could not resolve dependencies for project org.openmrs.modul
e:patientflags-api:jar:1.3.5-SNAPSHOT: The following artifacts could not be resolved: org.openmrs.api:openmrs-api:jar:1.
10.0-SNAPSHOT, org.openmrs.web:openmrs-web:jar:1.10.0-SNAPSHOT, org.openmrs.api:openmrs-api:jar:tests:1.10.0-SNAPSHOT, o
rg.openmrs.web:openmrs-web:jar:tests:1.10.0-SNAPSHOT, org.openmrs.test:openmrs-test:pom:1.10.0-SNAPSHOT: Could not find
artifact org.openmrs.api:openmrs-api:jar:1.10.0-SNAPSHOT in openmrs-repo (http://mavenrepo.openmrs.org/nexus/content/rep
ositories/public) -> [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/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :patientflags-api