I develop custom addons for a rather large application. I have no control over the dependencies that are provided by the software/pom and I’m currently trying to adapt our Gradle build script so our devs can use both Eclipse or IDEA.The application will first load all jars my addon needs and then its own jars in almost alphabetical order, meaning CAPITAL letters have precedence over lower case letters.
I’m using a custom “provided” configuration to handle the application dependencies.
So far so good. However, when I try to run the application together with my addons in IDEA the returned order of dependencies breaks the application.
As a workaround I used this in the gradle dependencies block:
compile fileTree(dir: “$lib”, include: ‘*.jar’).
This returns the jars in the order I need. However, it takes away the possibility to jump to the sources of the application both in Eclipse and in IDEA.
I have been trying to sort the dependencies and creating a new configuration on the fly but so far no luck. What I need to do is this (I think):
- fill a custom configuration with dependencies (more than 217 jars), all managed with maven - get the paths and file names - sort by file name - create new configuration with paths in alphabetical order - make sure, that sources still can be browsed
So, what is the best way to sort a pom controlled configuration? Or alternatively, is there a way to tell gradle where to find the sources for the jars in the lib folder so that Eclipse and IDEA recognize them? At the moment this is only a problem in IDEA, so the next thing I wanted to try is the whenMerged hook and sort the entries in there, hoping that the IDEA Gradle plugin will not revert my changes.