Openmrs-API build error

Hi, I am running into issues building openmrs-core straight out from Git - Master branch. Any ideas what I am missing? Please let me know.

Here is the pastebin error log - https://pastebin.com/B7g3WvZG

MVN version -

Maven home: /Users/kswarna/Documents/openmrs/apache-maven-3.5.2
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.2", arch: "x86_64", family: "mac"

Below are the failing test

Failed tests: 
  OpenmrsTestsTest.shouldHaveAtLeastOneTest:44->getTestClasses:136->getClasses:153 org.openmrs.test should be a directory
  OpenmrsTestsTest.shouldHaveClassNameEndWithTestIfContainsMethodTestAnnotations:111->getClasses:153 org.openmrs.test should be a directory
  OpenmrsTestsTest.shouldHaveTestAnnotationWhenStartingWithShould:85->getTestClasses:136->getClasses:153 org.openmrs.test should be a directory
  OpenmrsTestsTest.shouldStartWithShould:57->getTestClasses:136->getClasses:153 org.openmrs.test should be a directory
  ModuleFactoryTest.loadModules_shouldNotStartTheLoadedModules:165 expected:<3> but was:<0>
  ModuleFactoryTest.loadModules_shouldSetupRequirementMappingsForEveryModule:147 expected:<3> but was:<0>
Tests in error: 
  ModuleFactoryTest.loadModule_shouldAlwaysLoadModuleIfReplacementIsWanted:76->loadModule:178 » Module
  ModuleFactoryTest.loadModule_shouldLoadANewerVersionOfTheSameModule:89->loadModule:178 » Module
  ModuleFactoryTest.loadModule_shouldLoadModuleIfItIsCurrentlyNotLoaded:53->loadModule:178 » Module
  ModuleFactoryTest.loadModule_shouldNotLoadAnOlderVersionOfTheSameModule:101->loadModule:178 » Module
  ModuleFactoryTest.startModule_shouldStartAllDependencies:115->loadModule:178 » Module
  ModuleUtilTest.expandJar_shouldExpandDirectoryWithParentTreeIfNameIsDirectoryAndKeepFullPathIsTrue:628 » FileNotFound
  ModuleUtilTest.expandJar_shouldExpandDirectoryWithoutParentTreeIfNameIsDirectoryAndKeepFullPathIsFalse:649 » FileNotFound
  ModuleUtilTest.expandJar_shouldExpandEntireJarIfNameIsEmptyString:667 » FileNotFound
  ModuleUtilTest.expandJar_shouldExpandEntireJarIfNameIsNull:683 » FileNotFound ...
  ModuleUtilTest.expandJar_shouldExpandFileWithParentTreeIfNameIsFileAndKeepFullPathIsTrue:699 » FileNotFound

Tests run: 3772, Failures: 6, Errors: 10, Skipped: 38

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] OpenMRS ............................................ SUCCESS [  1.682 s]
[INFO] openmrs-tools ...................................... SUCCESS [  0.868 s]
[INFO] openmrs-test ....................................... SUCCESS [  0.080 s]
[INFO] openmrs-api ........................................ FAILURE [02:15 min]
[INFO] openmrs-web ........................................ SKIPPED
[INFO] openmrs-webapp ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:18 min
[INFO] Finished at: 2017-12-25T15:09:19-06:00
[INFO] Final Memory: 66M/738M

Delete it and try to clone afresh.

Thanks. I am wondering if this is related to Mac OS or JDK 1.8.0_151-b12. I tried multiple time to delete and clone new, ended up with same results. I had access to a windows machine and it just works fine. JDK version of windows is 1.8.0_141-b15.

Is it any better if you upgrade your java to at least 1.8.0_152?

Because it is a file access problem, can you also check the folder/file permissions?

The folder has read and execute permission to all users. I updated java to latest release 1.8.0_152 it did not help. Not sure what I am missing.

What do you have in this folder? /Users/kswarna/git/openmrs-core/api/target/test-classes/org/openmrs/module/include

@dkayiwa. Thanks. I think this is related to file path issue. I had a special character ‘@’ in the folder name and it was getting encoded to %40. I moved to a different directory structure and it worked. Thanks

Which folder was it that had the ‘@’ character?

The folder structure - /users/email@domain.com/git/openmrs-core/api/target/test-classes/org/openmrs/module/include

But the original one (which failed) did not have that character: /Users/kswarna/git/openmrs-core/api/target/test-classes/org/openmrs/module/include

Yes. I updated the email :slight_smile: before posting the thread, sorry about that.

Does it compile if you take it back to? /Users/kswarna/git/openmrs-core

Yes it does. I moved it to /users/shared/openmrs/ and was able to build without any issues. I think other solution might be to decode filepath before running the testcase.

Instead of running ‘mvn clean install’ command on the IDE (intelliJ IDEA) Terminal i used git bash to navigate to the project folder openmrs-core and ran ‘mvn clean install’ . it worked when i ran it on git bash instead if IDE terminal

Hi I am running into issues building openmrs-core from git master branch. Can someone help me with this ? Please let me know

[ERROR] Failures: [ERROR] ModuleFactoryTest.loadModules_shouldNotStartTheLoadedModules:165 expected:<3> but was:<0> [ERROR] ModuleFactoryTest.loadModules_shouldSetupRequirementMappingsForEveryModule:147 expected:<3> but was:<0> [ERROR] Errors: [ERROR] ModuleExtensionsTest.getExtensions_shouldNotFailExpandingAnExtensionNameCausingANoClassDefinitionFoundError:96 ▒ Module [ERROR] ModuleFactoryTest.loadModule_shouldAlwaysLoadModuleIfReplacementIsWanted:76->loadModule:179 ▒ Module [ERROR] ModuleFactoryTest.loadModule_shouldLoadANewerVersionOfTheSameModule:89->loadModule:179 ▒ Module [ERROR] ModuleFactoryTest.loadModule_shouldLoadModuleIfItIsCurrentlyNotLoaded:53->loadModule:179 ▒ Module [ERROR] ModuleFactoryTest.loadModule_shouldNotLoadAnOlderVersionOfTheSameModule:101->loadModule:179 ▒ Module [ERROR] ModuleFactoryTest.startModule_shouldStartAllDependencies:115->loadModule:179 ▒ Module [ERROR] ModuleFileParserTest.moduleFileParser_shouldFailCreatingParserFromFileIfInputStreamClosed:92 ▒ FileNotFound [ERROR] ModuleFileParserTest.parse_shouldParseValidLogicModuleFromFile:150 ▒ Module Un… [ERROR] ModuleFileParserTest.parse_shouldParseValidXmlConfigCreatedFromInputStream:105 ▒ FileNotFound [ERROR] ModuleUtilTest.expandJar_shouldExpandDirectoryWithParentTreeIfNameIsDirectoryAndKeepFullPathIsTrue:620 ▒ FileNotFound [ERROR] ModuleUtilTest.expandJar_shouldExpandDirectoryWithoutParentTreeIfNameIsDirectoryAndKeepFullPathIsFalse:641 ▒ FileNotFound [ERROR] ModuleUtilTest.expandJar_shouldExpandEntireJarIfNameIsEmptyString:659 ▒ FileNotFound [ERROR] ModuleUtilTest.expandJar_shouldExpandEntireJarIfNameIsNull:675 ▒ FileNotFound … [ERROR] ModuleUtilTest.expandJar_shouldExpandFileWithParentTreeIfNameIsFileAndKeepFullPathIsTrue:691 ▒ FileNotFound [ERROR] ModuleUtilTest.getPackagesFromFile_shouldSkipOptionalFoldersIfJarFile:735 ▒ FileNotFound

Remove spaces from the folder path where you put the openmrs source. Then compile again.

I am using git bash to do it my Maven and java are successfully set

$ mvn -version Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: C:\Program Files\apache-maven-3.6.3-bin\apache-maven-3.6.3 Java version: 1.8.0_251, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_251\jre Default locale: en_US, platform encoding: Cp1252 OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “windows”

$ java -version java version “1.8.0_251” Java™ SE Runtime Environment (build 1.8.0_251-b08) Java HotSpot™ 64-Bit Server VM (build 25.251-b08, mixed mode)

$ javac -version javac 1.8.0_251

I was using this $ mvn clean package and was getting the following error

Yeah it worked for me thanks for your help

Regards, Aditya Chaudhari