Spring Tool Suite
  1. Spring Tool Suite
  2. STS-3048

Refresh dependencies can cause duplicate (different version) Snapshot Jars to be on classpath.

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.1.0.RELEASE
    • Fix Version/s: None
    • Component/s: GRADLE
    • Labels:
      None
    • Environment:

      Windows 7. Gradle 1.2, 1.1 and possibly earlier versions of Gradle.

      Description

      I have an inhouse artifactory repository that holds my dependencies. Whenever a new snapshot is loaded into that repository I want to be able to right click on my project and select gradle>refresh dependencies. However, if I do that, I end up with two snapshot Jars on my classpath with the older one first. This really costs my team time and would be great to get fixed. The workaround that I use is to go into the Gradle Cache on my machine and delete the snapshot jar that will be updated before invoking refresh dependencies. This causes the desired behavior. However, it requires me to know which snapshots will be updated when and often requires that I quit Eclipse STS because it has that jar open so I can't delete it.

        Activity

        Hide
        Kris De Volder (c) added a comment - - edited

        Andrew... this sounds painful.

        As a first step we'll need to determine whether this is something that needs to be fixed in Gradle itself or the tooling. My first guess would be that its Gradle itself that is causing this.

        I am assuming that you have 'dependency management' enabled and the duplicate jars that are bugging you are entries in the 'Gradle Dependencies' classpath container?

        If so, STS really only populates the container based on information returned by the Gradle tooling API.

        So I think this is probably a bug in Gradle itself.

        That being said, it is probably still a good idea to implement a workaround on the STS side. Maybe somespecial handling to detect and remove the 'duplicate' entries.

        Do you think you could prepare a small sample project and some instructions on what I need to do exactly to reproduce your problem? (I.e I need to see a concrete example of the 'duplicate' entries, before I can think of a way to detect and filter out the duplicates).

        Thanks,

        Kris

        Show
        Kris De Volder (c) added a comment - - edited Andrew... this sounds painful. As a first step we'll need to determine whether this is something that needs to be fixed in Gradle itself or the tooling. My first guess would be that its Gradle itself that is causing this. I am assuming that you have 'dependency management' enabled and the duplicate jars that are bugging you are entries in the 'Gradle Dependencies' classpath container? If so, STS really only populates the container based on information returned by the Gradle tooling API. So I think this is probably a bug in Gradle itself. That being said, it is probably still a good idea to implement a workaround on the STS side. Maybe somespecial handling to detect and remove the 'duplicate' entries. Do you think you could prepare a small sample project and some instructions on what I need to do exactly to reproduce your problem? (I.e I need to see a concrete example of the 'duplicate' entries, before I can think of a way to detect and filter out the duplicates). Thanks, Kris
        Hide
        Andrew Spina added a comment -

        Hi Kris,

        Thanks for the quick response. I'll see if I can create a small, self contained example. It may be a while.

        Cheers,

        Andy

        Show
        Andrew Spina added a comment - Hi Kris, Thanks for the quick response. I'll see if I can create a small, self contained example. It may be a while. Cheers, Andy
        Hide
        Kris De Volder (c) added a comment -

        That would be great. Thanks. You may also want to raise your question / issue on the Gradle forum. I.e. I do suspect this is ultimately a Gradle bug rather than a STS bug. So even if we put 'workaround' for this in STS, it should also be fixed in Gradle itself.

        These 'avenues' can be explored in parallel.

        Kris

        PS: Link to gradle forums: http://forums.gradle.org/gradle

        Show
        Kris De Volder (c) added a comment - That would be great. Thanks. You may also want to raise your question / issue on the Gradle forum. I.e. I do suspect this is ultimately a Gradle bug rather than a STS bug. So even if we put 'workaround' for this in STS, it should also be fixed in Gradle itself. These 'avenues' can be explored in parallel. Kris PS: Link to gradle forums: http://forums.gradle.org/gradle
        Hide
        Andrew Spina added a comment -

        Hi Kris. Thanks again. I spent a while today trying to reproduce the problem in a simple project and I can't seem to make it happen. I guess it's more nuanced than I originally assumed. I'll post in the Gradle forums and continue to experiment with reproduction as I have time.

        Show
        Andrew Spina added a comment - Hi Kris. Thanks again. I spent a while today trying to reproduce the problem in a simple project and I can't seem to make it happen. I guess it's more nuanced than I originally assumed. I'll post in the Gradle forums and continue to experiment with reproduction as I have time.
        Hide
        Kris De Volder (c) added a comment -

        What do the duplicate entries look like precisely in your real project?

        I.e. is there a pattern that I could use to recognize and eliminate the duplicates?

        If so, I guess I could try to code-up a workaround. Though I would be a little nervous doing this kind of 'fixing a symptom' patch without really having a diagnosis of the root cause of the problem.

        Show
        Kris De Volder (c) added a comment - What do the duplicate entries look like precisely in your real project? I.e. is there a pattern that I could use to recognize and eliminate the duplicates? If so, I guess I could try to code-up a workaround. Though I would be a little nervous doing this kind of 'fixing a symptom' patch without really having a diagnosis of the root cause of the problem.
        Hide
        Andrew Spina added a comment -

        Hi Kris, I'll get you a better explanation of the duplicates next time the problem arises, but I agree with your reluctance to use a pattern to block the duplicates. I've posted on the gradle forums here: http://forums.gradle.org/gradle/topics/gradle_occasionally_duplicates_snapshot_dependencies_in_eclipse_sts_tooling_api?rfm=1

        Thanks again for your help.

        Show
        Andrew Spina added a comment - Hi Kris, I'll get you a better explanation of the duplicates next time the problem arises, but I agree with your reluctance to use a pattern to block the duplicates. I've posted on the gradle forums here: http://forums.gradle.org/gradle/topics/gradle_occasionally_duplicates_snapshot_dependencies_in_eclipse_sts_tooling_api?rfm=1 Thanks again for your help.
        Hide
        Kris De Volder (c) added a comment -

        Thanks Andrew, I'll keep an eye on that forum topic.

        Show
        Kris De Volder (c) added a comment - Thanks Andrew, I'll keep an eye on that forum topic.

          People

          • Assignee:
            Unassigned
            Reporter:
            Andrew Spina
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              First Response Date: