All library snapshots are added to com.intellij.openapi.roots.libraries.Library source roots.

When I start find usages of some class, and the class is used by some library of SNAPSHOT version, idea found lots of duplicated usages, for one for every ever downloaded snapshot. Is it a normal behavior?

 

UPD: Post caption was edited after discovering new details.

1
6 comments

All these usages are the same

0

We also figured out, that all these snapshots are also added as `Library` root sources. Why not only to add the last snapshot as a `Library` root source?

0

I didn’t understand the question. Only those libraries are attached that you import into your project explicitly. Please share your build configuration or sources of the entire project to recreate the issue

0

Hi, Alexander. We are developing a framework. Our test projects import its SNAPSHOT versions. After every snapshot is released, it doesn't simply replace the previous snapshot, but lies next to previous snapshot. And the sources of new snapshot appears in `com.intellij.openapi.roots.libraries.Library` root sources.

0

> Our test projects import its SNAPSHOT versions.

How? How is it related to `com.intellij.openapi.roots.libraries.Library`?

From the screenshot and the description, it's unclear what's happening and how to recreate the issue.

0

In this case, Library scope includes source code from lots of snapshots. And when we try to find usages, the search scope includes all these snapshots source codes. As the snapshots typically has the same classes, found usages contains a lot of duplicates.

Steps reproduce:

  1. Create some library, install it to local maven with version '1.0.0-SNAPSHOT'.
  2. Create gradle project and import the library. Refresh dependencies.
  3. Change library a bit and install it again.
  4. Refresh dependencies in gradle project.
  5. Repeat steps 3 and 4 several times.
  6. In gradle project try to find usages of some library class.
  7. You will see each usage as many times as you installed snapshot and refreshed dependencies.
0

Please sign in to leave a comment.