---
title: "【Maven】Missing artifact com.sun:tools:jar:1.5.0"
author: "cooliufang"
date: "2012-12-23T14:46:18Z"
tags: []
categories: ["开源软件"]
slug: "maven-missing-artifact-com-sun-tools-jar-1-5-0"
draft: false
lastmod: "2013-03-15T09:36:06Z"
id: 1752581
url: "https://smallwildpig.iteye.com/blog/1752581"
---

Eclipse maven has following error:
Missing artifact com.sun:tools:jar:1.5.0

Eclipse use "C:\windows\system32\javaw.exe" as default JVM, of course cant find tools.jar.

Solution I：
Modify eclipse.ini which in the eclipse.exe directory, add the following configuration:
**<span style="color:darkblue">-vm
D:\Program Files\Java\jdk1.6.0_37\bin\javaw.exe</span>**

Note:
1. -vm cannot have a space behind;
2. the first line is parameter, and the second line is the value, need to separate.
3. This configuration is in the front of the file best.


Solution II:

```xml
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  	<java.home>D:\Program Files\Java\jdk1.6.0_37</java.home>  
  </properties>
  
  <profiles>
     <profile>
		<id>default-tools.jar</id>  
		<activation>
		    <property>
		        <name>java.vendor</name>
		        <values>Sun.Microsystems Inc.</values>
		    </property>
		</activation>       
     </profile>
  </profiles>
  <dependencies>   
    <dependency>
        <groupId>com.sun</groupId>
        <artifactId>tools</artifactId>
        <version>1.5.0</version>
        <scope>system</scope>
        <systemPath>${java.home}/lib/tools.jar</systemPath>
    </dependency>
  </dependencies>
```


PS: here, <profiles> and <dependencies> must be sepreated, or it cant solve the problem.