Comments (8)
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.
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.
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.
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.
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.
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.
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.
Thanks for your effort. I will follow the issue on your tracker.
Tobias
from eclipse-integration-gradle.
Related Issues (20)
- Could not find tools.jar HOT 1
- “refresh all” update the eclipse .project file by force
- Classpath sorting removes test folder HOT 1
- Gradle-STS-to-Buildship message HOT 2
- Fail to initialize EclipseModelBuilder in gradle 2.14.1 if "Use Custom Tooling Model" is checked. HOT 4
- Alternative Update Sites Link To AccessDenied XML HOT 1
- import Gradle project HOT 1
- Trying to import project HOT 1
- Tooling API version older than 3.0 in sts 3.9.1.201710100515-RELEASE HOT 2
- Mark Gradle's build directories as derived resources HOT 3
- http proxy Ineffective HOT 5
- ":..:DependentProject" not supported in settings.gradle HOT 1
- I don't have an extension tab HOT 2
- Gradle IDE upgrade from 3.6.4 to 3.7.0 fails for missing dependencies HOT 4
- What is the roadmap for this plugin with the presence of the BuildShip plugin? HOT 2
- Remap Jars to Gradle Projects ignores version HOT 5
- Offline installation requires HOT 4
- Gradle plugin trying to download gradle.zip from internet even though Gradle Home pointed to local folder HOT 6
- "Updating Gradle Classpath" happens during/after "Building workspace" HOT 1
- NPE during Eclipse Gradle project refresh HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eclipse-integration-gradle.