【Maven】Missing artifact com.sun:tools:jar:1.5.0

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:
-vm
D:\Program Files\Java\jdk1.6.0_37\bin\javaw.exe


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:
<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.

你可能感兴趣的:(java,eclipse,maven)