How To Fix Issue Eclipse Maven Dependencies Jar Files Grayed Out

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.

  1. 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>
  2. 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.
  3. 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.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.