1

Hello to the whole community!

This is my first question on the forum, so I'll try to be precise:

I'm working on a project with a development team and I'm the only one using eclipse. The fact is that, since the implementation of a functionality that one of my colleagues did, eclipse warns me that there are two errors related to a dependency that it cannot resolve:

enter image description here

This does not happen to any of my colleagues, since they use different IDEs (VSCode or IntelliJ). The solutions that I have seen on the internet are based on touching dependency configuration files (in this case it is a gradle project so it would be touching the build.gradle file), but this is not possible in my case since if I modify something of that file I can harm my colleagues, I also suppose that there is another way to solve it from eclipse because if it only happens to me it must be something that has been corrupted.

That is why I call on the eclipse scholars in the forum to see if they can give me a hand, because with these errors, eclipse won't let me run the application in debug mode.

Greetings!

I have tried to look for information about it in other internet sites, but the solution of modifying configuration files cannot be applied to my case.

Manuel
  • 11
  • 1
  • See https://stackoverflow.com/a/53824670/6505250 and https://stackoverflow.com/a/74890645/6505250 – howlger Mar 23 '23 at 23:41

1 Answers1

1

This is a common problem in modular Java.

This issue occurs when:

  • modules are being referenced by your project
  • there is a dependency in your project
  • project contains lines of code
  • packages are also in modules

A key rule to know in Java is:

"In your own code, if the JDK has packages. Do not use those packages."

If you do this, you cannot go any further and will hit a wall.

To fix this, you will need to:

  1. In package explorer, expand the "External Dependencies and Projects" tab
  2. Determine and identify dependency is being used.
  3. Exclude the dependency from the project.
  4. If possible, rebuild the jar with packages that are changed, after obtaining the source of the dependency.
  5. If you do not complete the previous step, then you will have to remove the dependency and find a replacement.
David He
  • 11
  • 5
  • Hello! Thanks for your answer. I think I've found the bug; Eclipse cannot resolve the dependency because there are two packages with the same name (javax.xml.transform.dom) one imports it from the jdk and the other from gradle. The problem now is that it won't let me delete or exclude that package from the eclipse Java Build Path, in the Module Dependencies tab. If what I have to do is not use the jdk library (the javax.xml.transform.dom package specifically), I don't know how I can exclude it from the project. – Manuel Mar 24 '23 at 10:35