For Eclipse Java 2025-09
Exists a simple module project based with Java and Maven. This project works with dependencies. I have the following situation with the Maven Dependencies section as follows:
Among the dependencies shown:
For each own project through a Terminal was executed the mvn clean install command. Therefore is possible refer them as dependencies to reuse their types (interfaces, classes, etc). The project compiles and works normal without any problem
The reason of this post, for each of my own dependency project selected and highlight in blue, observe that:
Why this difference? or in other words:
Question
Note
mvn clean install) in the same repository.Extra Question
Why in Eclipse Java in the Maven Dependencies section some dependencies can be expanded and others not?
If Eclipse depends that a dependency is available as a Maven project in the same workspace, it is marked as a project dependency. This only works for Maven projects and wouldn't work for closed projects or if there's a mismatch in the artifact coordinates.
Is possible do some configuration to change all the dependencies from the "second" case (as directory icon) to the "first" case (as jar icon)?
You can go to Project > Properties > Maven and disable Resolve dependencies from workspace projects on the dependent project and update it with Alt+F5 (or right-click and select Update Project). Keep in mind that doing this requires you to use mvn install on the projects you depend on whenever you make a change there and have that change applied to the dependent project.
If your Maven project is depending on other dependencies which are opened projects in your workspace, it makes them project dependencies instead of depending on the JAR in the local Maven repository.
If you are depending on a different project (which is open in the same workspace), it means that changes to that project will be applied immediately and you don't have to run mvn install to get a new version of the dependency.
If you are depending on a JAR file, it will use the JAR in your ~/.m2/repository (or similar) directory so it doesn't know about changes you might make to the project. If you want to test changes to the dependency on the dependent project, you need to run mvn install in the dependency project to recreate the JAR (for every change you make).
Depending on the project is usually the better choice as it gives you a better development experience with the source code being consistent with the actually used version.
This also answers the question of why you can't expand it. A JAR file is essentially a zip file so Eclipse shows you the contents of that. Since you are dependent on a project in the other case, there is no JAR to show the contents of. If you want to see the project's contents, you can just go to the project. Alternatively, you can switch to using JAR dependencies, you can go to Project > Properties > Maven and disable Resolve dependencies from workspace projects on the dependent project and update it with Alt+F5 (or right-click and select Update Project). However, this will result in you having to mvn install the dependencies before being able to use the updated code as mentioned before.
If you want to be able to expand a project dependency like that, feel free to implement it yourself and contribute it. The corresponding repository would likely be JDT-UI (note that this repository contains the Java support but not the Maven support - but project dependencies are a general JDT (UI) concept and not a Maven/m2e concept).
For the question of why some dependencies are shown as JAR dependencies even though you have them opened as projects in the same workspace, I cannot be sure but I'd guess that you haven't opened them as Maven projects or the <version> in the pom.xml of the dependency does not match the version you are using in the dependent project's pom.xml (or you have some other mismatch in the artifact coordinates or maybe some fatal build error).
Finally, if you want to use JAR dependencies for some dependencies but not others, you can always close the projects you are depending on by right-clicking the project and selecting Close Project.
