Git Product home page Git Product logo

Comments (8)

kdvolder avatar kdvolder commented on April 20, 2024

The elements in the container are sorted alphabetically. I checked the code and the sorting is based on the full path rather than the name of the jar. Maybe that is not logical and it can be changed (it tends to end up soring based on 'group' first and then 'name' in the case of maven dependencies because the group name appears first in the path and the rest before that is identical).

Also, if you rather get the dependencies in the exact order as returned by gradle you can disable the sorting in the project's properties. Right click project and go to "Properties >> Gradle >> Classpath sorting".

If you disable the sorting I am not sure you will get the behavior you expect. The reason the sorting was put in is that gradle tends the return dependencies in an order that is unpredictable and depends on the OS.

With the sorting turned on at least you will get the same order for users on win / mac / linux.

However I do think there are ways for you to explicitly control the order from the build script if you are determined enough. Just don't ask me how :-)

It might also be that the problem this sorting was trying to addres no longer exists in more recent version of gradle. If that's the case we should probably disable sorting by default or even remove this feature completely.

Please try out the 'sorting disabled' setting and let me know if it works as you expected (and whether you think it should be turned off by default).

Kris

from eclipse-integration-gradle.

kdvolder avatar kdvolder commented on April 20, 2024

PS: Sorry it took me a long time to notice your issue. This is not the right place for raising issues so I don't look in here often. In the future please raise issues here: https://issuetracker.springsource.com/browse/STS

from eclipse-integration-gradle.

tHerrmann avatar tHerrmann commented on April 20, 2024

Hi Kris,

I thought the dependencies should be sorted in the same way I list them in the dependencies configuration. I'm rather new to gradle and was expecting it would behave similar to my classpath settings in eclipse where you can specify a certain order.
The gradle build script seemed to handle it that way also. Both on linux and windows.

Tobias

from eclipse-integration-gradle.

kdvolder avatar kdvolder commented on April 20, 2024

Yes, that does make the most sense, but I didn't implement the sorting on a whim. It was requested by a user.

It is possible the ordering issue this is trying to avoid no longer exists however. It was implemented quite a long time ago. Gradle has seen a lot of changes / improvement since then.

If that's the case flipping the default to not sorting things would probably be best.

Since you seem to have a situation where the order matters, maybe you can confirm things work right for you if the option is turned off. That is an interesting data point :-)

from eclipse-integration-gradle.

kdvolder avatar kdvolder commented on April 20, 2024

I dug up the old issue: https://issuetracker.springsource.com/browse/STS-2175

Reading through it, the motivation for the sorting was unpredictable order in project type dependencies (not jar dependencies).

Maybe the sorting strategy shouldn't be applied as aggressively as it currently is. For example, maybe it should not be applied to elements inside the container. But it probably still makes sense to keep the entries in the .classpath file in a kind of sorted/predictable order.

from eclipse-integration-gradle.

kdvolder avatar kdvolder commented on April 20, 2024

More reading through the old issue, now I actually think the reason for the unstable ordering may have been the users build script! He mentioned having some code iterating a directory to create project dependencies.

More and more making a case for switching the sorting off by default.

from eclipse-integration-gradle.

kdvolder avatar kdvolder commented on April 20, 2024

I've raised an issue in STS issue tracker to fix this. Closing this issue here.
Thanks for reporting and following up. Your input is most valuable!

https://issuetracker.springsource.com/browse/STS-3567

from eclipse-integration-gradle.

tHerrmann avatar tHerrmann commented on April 20, 2024

Thanks for your effort. I will follow the issue on your tracker.

Tobias

from eclipse-integration-gradle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.