Oct 27, 2015

tool.jar not found error, during maven clean build

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.4:compile (default-compile) on project springmvc: Fatal error compiling: tools.jar not found: C:\Program Files (x86)\Java\jre7\..\lib\tools.jar -> [Help 1]











We typically encounter this error when we have a JRE instead of JDK. Configuring JDK will eclipse will resolve this issue

Steps to configure JDK in eclipse:

1. Window -> Preferences -> Java-> Installed JREs
2. Click on [Add] button and select the JDK from the file-system
3. Select the newly added JDK and click on [Finish]

How to change the location of Maven repository



By default the maven repository is created in C:\Users\username\.m2\repository
Below are the steps to change the location of Maven repository.

1. Edit the settings.xml file in location C:\Users\<user-name>\.m2\settings.xml

2. Add the line highlighted below.

  <settings>
  <localRepository>D:/Softs/mvnrepo/repository</localRepository>
  <servers>
    <server>
      <id>maven.gtk.com</id>
      <username>domain\username</username>
      <password>pass1</password>     
    </server>
  </servers>
</settings>