问题
I am facing this issue , when i am deploying my application using Maven, please suggest some solution.
Error log,
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.790s
[INFO] Finished at: Wed Apr 23 10:44:13 IST 2014
[INFO] Final Memory: 54M/131M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project clustering.services: Fatal error compiling: tools.jar not found: C:\Program Files\Java\jre7\..\lib\tools.jar -> [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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :clustering.services
Thanks in advance.
回答1:
set JAVA_HOME
to jdk not to JDK_DIR/jre
, See this question for how to set the value
回答2:
If you're using Eclipse, go to Windows->Preferences. Under Java->Installed JREs, double click on the item in the list and make sure the JRE home points to a JDK (for example, set it to "C:\Program Files\Java\jdk1.7.0_60"), and leave everything else the same.
回答3:
LOL. Take this scenario as well.
Your last server is UP (may be jetty). And You are deploying(copying same source),running the same app.
PORT CONFLICT
回答4:
Verify that the name of the main class to execute in the application is specified in the pom.xml.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>com.enterprise.mainPacket.MainApp</mainClass>
</properties>
Also check if the .fxml file has been relocated, so that it correctly addresses the controller associated with it. fx:controller="com.enterprise.mainPacket.FXMLController"
<VBox fx:id="vBMasterContainer" prefHeight="698.0" prefWidth="800.0" styleClass="theme" stylesheets="@/styles/style.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.enterprise.mainPacket.FXMLController">
回答5:
make sure that you don't have empty pakages within your sourcecode folder.If there are no any classes Same error will occur
回答6:
Check that there are no conflict on the port (another service already running) !
回答7:
I had the same error. i fixed the path to java, and was missing the tools jar. i copied it from another place. after that everything worked.
回答8:
I changed the version in pom.xml to 1.2.1 and the error was resolved.
回答9:
Most of the time that i get this "Mojo" error. It is just because, i forgot to do "Maven generate-sources" and/or "Maven Clean" prior to do the "Maven Install" and/or the "Maven Build" then the MojoExecutionException won't appear.
来源:https://stackoverflow.com/questions/23235430/maven-mojoexecutionexception