Specify tools. jar for Maven to solve the missing artifact com. Sun: Tools: jar: 1.5.0 error.

Source: Internet
Author: User

After importing the maven project using eclipse with the m2eclipse plug-in installed, Pom. XML start position: missing artifact COM. the Sun: Tools: jar: 1.5.0 error is not a big problem, but this error will block the eclipse build Maven project. There are two solutions to this problem:

Method 1:

Find the eclipse. ini file in the eclipse installation directory and append the VM parameter to the-vmargs parameter. The following is an example:

-VM
D: \ Java \ jdk1.6.0 _ 37 \ bin \ javaw.exe

For instructions on the eclipse. ini file and-VM parameter settings, refer to: http://wiki.eclipse.org/Eclipse.ini

However, sometimes eclipse is modified. you can right-click the project, select Maven> disable Maven nature, and right-click Configure-> convert to Maven project.

Method 2:

Specify the tools. Jar dependency in the POM file, refer to: http://maven.apache.org/general.html#tools-jar-dependency:

<Profiles> <profile> <ID> default-tools.jar </ID> <activation> <property> <Name> JAVA. vendor </Name> <value> Sun Microsystems Inc. </value> </property> </activation> <dependencies> <dependency> <groupid> COM. sun </groupid> <artifactid> tools </artifactid> <version> 1.6 </version> <scope> System </scope> <systempath >$ {Java. home }/.. /lib/tools. jar </systempath> </dependency> </dependencies> </profile> </profiles>

Replace the value of <version/> with your JDK version.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.