Error during setting up openmrs-core

Hey! On running mvn clean install in the project root, I am getting this:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.1:compile (default-compile) on project openmrs-tools: Compilation failure: Compilation failure: 
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[15,28] error: package com.sun.tools.doclets does not exist
[ERROR] 
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[20,37] error: cannot find symbol
[ERROR] 
[ERROR]  class Taglet
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[29,1] error: method does not override or implement a method from a supertype
[ERROR] 
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[40,1] error: method does not override or implement a method from a supertype
[ERROR] 
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[51,1] error: method does not override or implement a method from a supertype
[ERROR] 
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[62,1] error: method does not override or implement a method from a supertype
[ERROR] 
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[73,1] error: method does not override or implement a method from a supertype
[ERROR] 
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[84,1] error: method does not override or implement a method from a supertype
[ERROR] 
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[96,1] error: method does not override or implement a method from a supertype
[ERROR] 
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[107,1] error: method does not override or implement a method from a supertype
[ERROR] 
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[119,2] error: cannot find symbol
[ERROR] 
[ERROR]  class ShouldTaglet
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[119,14] error: cannot find symbol
[ERROR] 
[ERROR]  class ShouldTaglet
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[132,1] error: method does not override or implement a method from a supertype
[ERROR] 
[ERROR] /home/shivansh/opensource/openmrs-core/tools/src/main/java/org/openmrs/tools/doclet/ShouldTaglet.java:[143,1] error: method does not override or implement a method from a supertype
[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/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :openmrs-tools

On looking up, I found out that the doc says to use Java8 instead of the latest version. So I downgraded from Java11 to Java8 and updated the alternatives for java and javac. But the error still persists.

Any fixes for this?

That’s still the error you get when Maven is using Java 9 or newer, and you’ll probably see Java 11 reported if you run mvn --version. If you did install Java 8 and set it as your system default, this might be fixed as easily as restarting your terminal or logging out and then logging back in. Otherwise, the instructions might depend on what flavour of Linux you’re running. On Ubuntu, for example, you’d need to run sudo update-alternatives --config java.

1 Like

@iamsr sure as @ibacher says , your maven seems to be pointing to a different jdk rather than 8 .

Thanks @ibacher @mozzy! You’re right. Maven is using Java 11 as of now, even though I did run sudo update-alternatives --config java. I also tried reinstalling Maven. Maybe completely removing Java11 would help.

1 Like

[UPDATE] Finally, updating JAVA_HOME environment variable worked! It was pointing to Java11 because of which maven was using Java11.

1 Like