I add a dependency in my eclipse maven project pom.xml file, and when I save the project, eclipse downloads all the dependency required jar files under the eclipse project —> Maven Dependencies folder. But when expand the Maven Dependencies folder I found all the dependency required jar files are grayed out. And the class in the jar files can not be imported in the java source code. This article will tell you how to fix this issue.
1. How To Fix The Eclipse Maven Dependencies Jar Files Grayed Out Issue.
- The reason for this issue is the <scope> XML element in the dependency declaration.
<dependency> <groupId>net.lightbody.bmp</groupId> <artifactId>browsermob-core</artifactId> <version>2.1.5</version> <scope>test</scope> </dependency>
- In the above maven dependency XML section, the dependency <scope> value is test, then the dependency jar files can only be imported in the eclipse maven project src/test/java folder.
- Remove the <scope>test</scope> XML element from the dependency maven declaration can fix the error. After you remove it, do not forget to save the eclipse maven project to make the changes take effect.