#IssueFix: Missing artifact jdk.tools:jdk.tools:jar:1.6 in Eclipse
Most of us face this issue when they are working with Hadoop related source codes. Maven starts reporting a missing dependency.
Issue #
Missing artifact jdk.tools:jdk.tools:jar:1.6
in pom.xml and hence project would not build.
RCA #
The main reason behind this issue is that, the project depends in tools.jar
which contains additional tools and utilities in JDK. These dependencies are not available in JRE without JDK. There is an issue with Maven plugin in Eclipse. Instead of using JRE which is set to build an individual project, Maven plugin uses JRE used by Eclipse.
In this case, eclipse was started with JRE which is without JDK and hence Maven could not located tools.jar
Solution #
Solution would be to start eclipse with JRE that is inside JDK. To do so, open eclipse.ini
[OR sts.ini
] and add following lines,
Please adjust path to javaw.exe
as per necessity.
This might not work on all systems. If you encounter Java was started but returned exit code=1
error while starting the eclipse, modify the -vm
argument to point to jvm.dll
:
For Linux:
For MacOS:
Paths can be different, please adjust accordingly.
If for some reason, you cannot edit ini
file then you can modify the project pom.xml
instead.
Add the following dependency to your pom file:[You should not add system specific dependencies in pom.xml
though]
Refresh the project along with Maven dependencies and you should be good to go.
You can simply build your project from command line Maven commands. It should still work.