Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build failure run "mvn clean install". I just upgraded Big Sur

Tags:

java

maven

mvn clean install building failure

  [INFO] Total time:  1.911 s
    [INFO] Finished at: 2020-11-14T19:07:37+08:00
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project es-starter: Compilation failure
    [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
    [ERROR]
    [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

Java & Maven environment

➜

      ~ which java
    /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
    ➜  ~ mvn -v
    Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T03:00:29+08:00)
    Maven home: /Users/munan/Documents/work/develop/maven/apache-maven-3.6.1
    Java version: 1.8.0_192, vendor: Oracle Corporation, runtime: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
    Default locale: zh_CN, platform encoding: UTF-8
    OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"

It seems that there is no problem with the environment. So where is the problem that caused the build to fail?

like image 465
munan Avatar asked Nov 14 '20 11:11

munan


People also ask

Why mvn is not recognized in Mac?

Make sure that JAVA_HOME is set to the location of your JDK, e.g. export JAVA_HOME=/usr/java/jdk1. 5.0_02 and that $JAVA_HOME/bin is in your PATH environment variable. Run mvn --version to verify that it is correctly installed.

Does mvn clean install build?

clean is its own build lifecycle phase (which can be thought of as an action or task) in Maven. mvn clean install tells Maven to do the clean phase in each module before running the install phase for each module.

Is mvn clean necessary?

On Maven, each time you want to compile, the best practice is to run mvn clean . It clears out the existing classes that you compiled from last compile. If you don't want to run 3 lines, just do "mvn test" after mvn clean . You don't have to always do mvn compile .

How do I run after maven clean install?

Once you have this installed, you should be able to run all the maven commands. To do so, from the package explorer, you would right click on either the maven project or the pom. xml in the maven project, highlight Run As, then click Maven Install. Hope this helped.


1 Answers

BigSur added JRE path for some reason and I uninstalled the JRE as I needed the JDK (and not JRE) and it worked.

  1. Go to /Library/Internet Plug-Ins.
  2. Remove the JavaAppletPlugin.plugin directory by executing the rm command as a root user or by using the sudo tool.
  3. Go to /Library/PreferencePanes.
  4. Remove JavaControlPanel.prefpane by executing the rm command as a root user or by using the sudo tool.
like image 87
anudeep b Avatar answered Oct 19 '22 10:10

anudeep b