17

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.

astack
  • 3,837
  • 7
  • 22
  • 21

8 Answers8

16

set JAVA_HOME to jdk not to JDK_DIR/jre, See this question for how to set the value

Community
  • 1
  • 1
jmj
  • 237,923
  • 42
  • 401
  • 438
6

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.

Alex
  • 61
  • 1
  • 2
2

Most of the time that i get this "Mojo" error. It is just because, i may have forgotten to do "Maven generate-sources" then "Maven Clean" prior to do the "Maven Install" or "Maven Build". The MojoExecutionException should not appear after that. Some Eclipse versions have this problem to refresh the target folder. In this case, Refresh the project just after the "Maven Install".

enter image description here

If not resolved yet, it could be a lot of things (failed to copy a file(s), missing file(s), etc). I would suggest that you run the Maven Install in debug mode by adding -X to get more details on what may have happened then check your log: Right click on project> Run As> Maven Build as the following screenshot:

Compile with -X

Supercoder
  • 1,066
  • 1
  • 10
  • 16
0

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">
0

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.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Alex Stoliar
  • 305
  • 3
  • 8
-1

Make sure that you don't have any empty packages within your source code folder. If there aren't any classes, the same error will occur.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
chamzz.dot
  • 607
  • 2
  • 12
  • 24
-1

Check that there are no conflict on the port (another service already running) !

Aguid
  • 943
  • 2
  • 10
  • 24
-1

After I changed the version in pom.xml to 1.2.1, the error was resolved.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77