Maven issue with new module

OpenMRS: Standalone 2.2

A colleague has successfully developed/added a module on his iMac, OpenMRS Standalone 2.2. There were no issues in using Netbeans 7.4 to clean/build and then upload the module to OpenMRS. However, when I attempt to clean/build I get the following Maven dependencies issues (see below). I’m running the openmrs standalone 2.2 on my Mac Yosemite, jdk 1.6, Maven 3.3.3

The module can be found here: https://www.dropbox.com/l/TjSvOyHaLQhvFRVG47d0Hu

A copy of the clean/build output follows. Note, I tried following the suggestions at the end of the clean/build output without luck.

Thanks much for your help.

cd /Users/tenzinyoudon/Downloads/basictest; JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home "/Applications/NetBeans/NetBeans 8.0.2.app/Contents/Resources/NetBeans/java/maven/bin/mvn" clean install
/etc/mavenrc: line 1: -v: command not found
Scanning for projects...
------------------------------------------------------------------------
Reactor Build Order:

SDK Example Module
SDK Example Module API
SDK Example Module OMOD
------------------------------------------------------------------------
Building SDK Example Module 1.0-SNAPSHOT
------------------------------------------------------------------------
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml (798 B at 1.0 KB/sec)

--- maven-clean-plugin:2.4.1:clean (default-clean) @ basictest ---

--- maven-install-plugin:2.3.1:install (default-install) @ basictest ---
Installing /Users/tenzinyoudon/Downloads/basictest/pom.xml to /Users/tenzinyoudon/.m2/repository/org/openmrs/module/basictest/1.0-SNAPSHOT/basictest-1.0-SNAPSHOT.pom
------------------------------------------------------------------------
Building SDK Example Module API 1.0-SNAPSHOT
------------------------------------------------------------------------

--- maven-clean-plugin:2.4.1:clean (default-clean) @ basictest-api ---
Deleting /Users/tenzinyoudon/Downloads/basictest/api/target

--- maven-resources-plugin:2.5:resources (default-resources) @ basictest-api ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 7 resources

--- maven-compiler-plugin:2.3.2:compile (default-compile) @ basictest-api ---
Compiling 6 source files to /Users/tenzinyoudon/Downloads/basictest/api/target/classes

--- maven-resources-plugin:2.5:testResources (default-testResources) @ basictest-api ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory /Users/tenzinyoudon/Downloads/basictest/api/src/test/resources

--- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ basictest-api ---
Nothing to compile - all classes are up to date

--- maven-surefire-plugin:2.10:test (default-test) @ basictest-api ---
No tests to run.
Surefire report directory: /Users/tenzinyoudon/Downloads/basictest/api/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0


--- maven-jar-plugin:2.3.2:jar (default-jar) @ basictest-api ---
Building jar: /Users/tenzinyoudon/Downloads/basictest/api/target/basictest-api-1.0-SNAPSHOT.jar

--- maven-install-plugin:2.3.1:install (default-install) @ basictest-api ---
Installing /Users/tenzinyoudon/Downloads/basictest/api/target/basictest-api-1.0-SNAPSHOT.jar to /Users/tenzinyoudon/.m2/repository/org/openmrs/module/basictest-api/1.0-SNAPSHOT/basictest-api-1.0-SNAPSHOT.jar
Installing /Users/tenzinyoudon/Downloads/basictest/api/pom.xml to /Users/tenzinyoudon/.m2/repository/org/openmrs/module/basictest-api/1.0-SNAPSHOT/basictest-api-1.0-SNAPSHOT.pom
------------------------------------------------------------------------
Building SDK Example Module OMOD 1.0-SNAPSHOT
------------------------------------------------------------------------
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/module/appui-omod/1.4-SNAPSHOT/maven-metadata.xml
Aug 17, 2015 7:11:12 AM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryExecute
INFO: I/O exception (org.apache.maven.wagon.providers.http.httpclient.NoHttpResponseException) caught when processing request: The target server failed to respond
Aug 17, 2015 7:11:12 AM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryExecute
INFO: Retrying request
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/module/appui-omod/1.4-SNAPSHOT/maven-metadata.xml (990 B at 1.4 KB/sec)
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/module/appui/1.4-SNAPSHOT/maven-metadata.xml
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/module/appui/1.4-SNAPSHOT/maven-metadata.xml (600 B at 3.2 KB/sec)
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/distro/referenceapplication/maven-metadata.xml
Downloading: http://repo.maven.apache.org/maven2/org/openmrs/distro/referenceapplication/maven-metadata.xml
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/distro/referenceapplication/maven-metadata.xml (31 KB at 99.6 KB/sec)
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/distro/referenceapplication/2.1-SNAPSHOT/maven-metadata.xml
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/distro/referenceapplication/2.1-SNAPSHOT/referenceapplication-2.1-SNAPSHOT.pom
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/api/openmrs-api/1.12.0-SPRING4-SNAPSHOT/maven-metadata.xml
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/api/openmrs-api/1.12.0-SPRING4-SNAPSHOT/maven-metadata.xml (1 KB at 3.3 KB/sec)
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/openmrs/1.12.0-SPRING4-SNAPSHOT/maven-metadata.xml
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/openmrs/1.12.0-SPRING4-SNAPSHOT/maven-metadata.xml (834 B at 3.9 KB/sec)
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/module/appframework-api/2.4-SNAPSHOT/maven-metadata.xml
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/module/appframework-api/2.4-SNAPSHOT/maven-metadata.xml (992 B at 5.2 KB/sec)
Downloading: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/module/appframework/2.4-SNAPSHOT/maven-metadata.xml
Downloaded: http://mavenrepo.openmrs.org/nexus/content/repositories/public/org/openmrs/module/appframework/2.4-SNAPSHOT/maven-metadata.xml (605 B at 1.3 KB/sec)
------------------------------------------------------------------------
Reactor Summary:

SDK Example Module ................................ SUCCESS [1.504s]
SDK Example Module API ............................ SUCCESS [4.542s]
SDK Example Module OMOD ........................... FAILURE [3.369s]
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 10.412s
Finished at: Mon Aug 17 07:11:15 PDT 2015
Final Memory: 21M/109M
------------------------------------------------------------------------
Failed to execute goal on project basictest-omod: Could not resolve dependencies for project org.openmrs.module:basictest-omod:jar:1.0-SNAPSHOT: Failed to collect dependencies for [org.openmrs.module:basictest-api:jar:1.0-SNAPSHOT (compile), org.openmrs.module:appui-omod:jar:1.4-SNAPSHOT (compile), org.openmrs.api:openmrs-api:jar:1.12.0-SPRING4-SNAPSHOT (provided), org.openmrs.web:openmrs-web:jar:1.9.7 (provided), org.openmrs.api:openmrs-api:jar:tests:1.9.7 (test), org.openmrs.web:openmrs-web:jar:tests:1.9.7 (test), org.openmrs.test:openmrs-test:pom:1.9.7 (test), org.openmrs.module:uiframework-api:jar:3.2.1 (provided), org.openmrs.module:appframework-api:jar:2.4-SNAPSHOT (provided)]: Failed to read artifact descriptor for org.openmrs.module:appui-api:jar:1.2.2: Could not find artifact org.openmrs.distro:referenceapplication:pom:2.1-SNAPSHOT in openmrs-repo (http://mavenrepo.openmrs.org/nexus/content/repositories/public) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

After correcting the problems, you can resume the build with the command
  mvn <goals> -rf :basictest-omod

@tibwangchuk Hi :smiley:

Some times the problem is with maven, I think they did not get installed properly. It should work if that is the problem. Go to the location where these exists, delete basictest-api-1.0-SNAPSHOT.jar and basictest-api-1.0-SNAPSHOT.pom and try building again?

Keep us posted if it doesn’t work, we can look into what else the problem could be.

Hi, I deleted both the file basictest-api-1.0-SNAPSHOT.jar and basictest-api-1.0-SNAPSHOT.pom. Then I build the module. It shows the same dependency error as below.

Tenzins-MacBook-Air-2:basictest tenzinyoudon$ mvn clean install
/etc/mavenrc: line 1: -v: command not found
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] SDK Example Module
[INFO] SDK Example Module API
[INFO] SDK Example Module OMOD
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building SDK Example Module 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ basictest ---
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ basictest ---
[INFO] Installing /Users/tenzinyoudon/Downloads/basictest/pom.xml to /Users/tenzinyoudon/.m2/repository/org/openmrs/module/basictest/1.0-SNAPSHOT/basictest-1.0-SNAPSHOT.pom
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building SDK Example Module API 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ basictest-api ---
[INFO] Deleting /Users/tenzinyoudon/Downloads/basictest/api/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ basictest-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 7 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ basictest-api ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /Users/tenzinyoudon/Downloads/basictest/api/target/classes
[WARNING] /Users/tenzinyoudon/Downloads/basictest/api/src/main/java/org/openmrs/module/basictest/api/db/hibernate/HibernateLabOrderDAO.java: /Users/tenzinyoudon/Downloads/basictest/api/src/main/java/org/openmrs/module/basictest/api/db/hibernate/HibernateLabOrderDAO.java uses unchecked or unsafe operations.
[WARNING] /Users/tenzinyoudon/Downloads/basictest/api/src/main/java/org/openmrs/module/basictest/api/db/hibernate/HibernateLabOrderDAO.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ basictest-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/tenzinyoudon/Downloads/basictest/api/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ basictest-api ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ basictest-api ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ basictest-api ---
[INFO] Building jar: /Users/tenzinyoudon/Downloads/basictest/api/target/basictest-api-1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ basictest-api ---
[INFO] Installing /Users/tenzinyoudon/Downloads/basictest/api/target/basictest-api-1.0-SNAPSHOT.jar to /Users/tenzinyoudon/.m2/repository/org/openmrs/module/basictest-api/1.0-SNAPSHOT/basictest-api-1.0-SNAPSHOT.jar
[INFO] Installing /Users/tenzinyoudon/Downloads/basictest/api/pom.xml to /Users/tenzinyoudon/.m2/repository/org/openmrs/module/basictest-api/1.0-SNAPSHOT/basictest-api-1.0-SNAPSHOT.pom
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building SDK Example Module OMOD 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] SDK Example Module ................................. SUCCESS [  0.389 s]
[INFO] SDK Example Module API ............................. SUCCESS [  3.269 s]
[INFO] SDK Example Module OMOD ............................ FAILURE [  0.317 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.706 s
[INFO] Finished at: 2015-08-17T19:37:08-07:00
[INFO] Final Memory: 25M/181M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project basictest-omod: Could not resolve dependencies for project org.openmrs.module:basictest-omod:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.openmrs.module:appui-omod:jar:1.4-SNAPSHOT -> org.openmrs.module:appui-api:jar:1.2.2: Failed to read artifact descriptor for org.openmrs.module:appui-api:jar:1.2.2: Failure to find org.openmrs.distro:referenceapplication:pom:2.1-SNAPSHOT in http://mavenrepo.openmrs.org/nexus/content/repositories/public was cached in the local repository, resolution will not be reattempted until the update interval of openmrs-repo has elapsed or updates are forced -> [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 :basictest-omod

Thank you.

Your problem is with the version of the appui-omod in the pom.xml of the basictest-omod. Change it to 1.3 as shown below:

     <dependency>
        <groupId>org.openmrs.module</groupId>
        <artifactId>appui-omod</artifactId>
        <version>1.3</version>
        <type>jar</type>
        <scope>provided</scope>
    </dependency>

Hi, If i change the appui-omod version to 1.3 in the pom.xml of the basictest-omod, org.openmrs.module appui-omod 1.3 jar provided

then I get a dependency error on CallSubAppPageController.java and ReadFilePageController.java under org.openmrs.module.basictest.page.controller, since import org.openmrs.module.appui.UiSessionContext; import org.openmrs.module.appui.UiSessionContext; on those two java file rely on org.openmrs.module appui-omod 1.4-SNAPSHOT jar

I cannot figure out how to fix this. Thank you.

@tibwangchuk, where do you see this error? compiles fine for me. Is this when you are deploying the module to OpenMRS?

@sunbiz, As soon as I changed the version to 1.3 in the pom.xml of the basictest-omod and click save all on the Netbeans IDE 8.0.2. Those two java file turn red in color and says package org.openmrs.module.appui does not exist on import org.openmrs.module.appui.UiSessionContext;

And when clean and build on the module with version changed to 1.3, i still get the following error.

cd /Users/tenzinyoudon/Downloads/basictest; JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home "/Applications/NetBeans/NetBeans 8.0.2.app/Contents/Resources/NetBeans/java/maven/bin/mvn" clean install
/etc/mavenrc: line 1: -v: command not found
Scanning for projects...
------------------------------------------------------------------------
Reactor Build Order:

SDK Example Module
SDK Example Module API
SDK Example Module OMOD
                                                                        
------------------------------------------------------------------------
Building SDK Example Module 1.0-SNAPSHOT
------------------------------------------------------------------------

--- maven-clean-plugin:2.4.1:clean (default-clean) @ basictest ---

--- maven-install-plugin:2.3.1:install (default-install) @ basictest ---
Installing /Users/tenzinyoudon/Downloads/basictest/pom.xml to /Users/tenzinyoudon/.m2/repository/org/openmrs/module/basictest/1.0-SNAPSHOT/basictest-1.0-SNAPSHOT.pom
                                                                        
------------------------------------------------------------------------
Building SDK Example Module API 1.0-SNAPSHOT
------------------------------------------------------------------------

--- maven-clean-plugin:2.4.1:clean (default-clean) @ basictest-api ---
Deleting /Users/tenzinyoudon/Downloads/basictest/api/target

--- maven-resources-plugin:2.5:resources (default-resources) @ basictest-api ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 7 resources

--- maven-compiler-plugin:2.3.2:compile (default-compile) @ basictest-api ---
Compiling 6 source files to /Users/tenzinyoudon/Downloads/basictest/api/target/classes

--- maven-resources-plugin:2.5:testResources (default-testResources) @ basictest-api ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory /Users/tenzinyoudon/Downloads/basictest/api/src/test/resources

--- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ basictest-api ---
Nothing to compile - all classes are up to date

--- maven-surefire-plugin:2.10:test (default-test) @ basictest-api ---
No tests to run.
Surefire report directory: /Users/tenzinyoudon/Downloads/basictest/api/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0


--- maven-jar-plugin:2.3.2:jar (default-jar) @ basictest-api ---
Building jar: /Users/tenzinyoudon/Downloads/basictest/api/target/basictest-api-1.0-SNAPSHOT.jar

--- maven-install-plugin:2.3.1:install (default-install) @ basictest-api ---
Installing /Users/tenzinyoudon/Downloads/basictest/api/target/basictest-api-1.0-SNAPSHOT.jar to /Users/tenzinyoudon/.m2/repository/org/openmrs/module/basictest-api/1.0-SNAPSHOT/basictest-api-1.0-SNAPSHOT.jar
Installing /Users/tenzinyoudon/Downloads/basictest/api/pom.xml to /Users/tenzinyoudon/.m2/repository/org/openmrs/module/basictest-api/1.0-SNAPSHOT/basictest-api-1.0-SNAPSHOT.pom
                                                                        
------------------------------------------------------------------------
Building SDK Example Module OMOD 1.0-SNAPSHOT
------------------------------------------------------------------------
------------------------------------------------------------------------
Reactor Summary:

SDK Example Module ................................ SUCCESS [0.381s]
SDK Example Module API ............................ SUCCESS [4.458s]
SDK Example Module OMOD ........................... FAILURE [0.817s]
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 6.677s
Finished at: Tue Aug 18 13:46:40 PDT 2015
Final Memory: 23M/182M
------------------------------------------------------------------------
Failed to execute goal on project basictest-omod: Could not resolve dependencies for project org.openmrs.module:basictest-omod:jar:1.0-SNAPSHOT: Failed to collect dependencies for [org.openmrs.module:basictest-api:jar:1.0-SNAPSHOT (compile), org.openmrs.module:appui-omod:jar:1.3 (compile), org.openmrs.api:openmrs-api:jar:1.12.0-SPRING4-SNAPSHOT (provided), org.openmrs.web:openmrs-web:jar:1.9.7 (provided), org.openmrs.api:openmrs-api:jar:tests:1.9.7 (test), org.openmrs.web:openmrs-web:jar:tests:1.9.7 (test), org.openmrs.test:openmrs-test:pom:1.9.7 (test), org.openmrs.module:uiframework-api:jar:3.2.1 (provided), org.openmrs.module:appframework-api:jar:2.4-SNAPSHOT (provided), org.openmrs.module:appframework-omod:jar:2.4-SNAPSHOT (compile)]: Failed to read artifact descriptor for org.openmrs.module:appui-api:jar:1.2.2: Failure to find org.openmrs.distro:referenceapplication:pom:2.1-SNAPSHOT in http://mavenrepo.openmrs.org/nexus/content/repositories/public was cached in the local repository, resolution will not be reattempted until the update interval of openmrs-repo has elapsed or updates are forced -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

After correcting the problems, you can resume the build with the command
  mvn <goals> -rf :basictest-omod

Thank you.

Ok, this is what I did to make things work for me after downloading your module from dropbox open the basictest/pom.xml and update the appuiVersion to 1.3

<appuiVersion>1.3</appuiVersion>

I go to basictest/api/pom.xml and remove the version entries for dependencies because the parent pom should take care of it. So the below two are removed from uiframework-api and appframework-api

<version>${appframeworkVersion}</version>
<version>${uiframeworkVersion}</version>

I then open basictest/omod/pom.xml and change the appui-omod version to 1.3, as shown in the earlier post. I then do a clean and build. And the module builds fine. Does it not build if you make these changes?

I also suggest that you correct the openmrs platform versioning. In the parent pom, you have 1.9.7 in the omod pom you have 1.12.0-SPRING4-SNAPSHOT. I also recommend not using the SNAPSHOT for the appframework-api

@sunbiz It builds fine with no any dependency error after following your comments. Thank you so much for your help.

2 Likes