0

I have one real issue with defining order of dependencies, eg. I have a gradle dependency which looks like this:

configurations {
    defaults
    configs
}

task extractDefaults(type: Copy) {
    from { configurations.defaults.collect { it.isDirectory() ? it : zipTree(it) } }
    into "$buildDir/defaults/"
}

in other file i have

dependencies {
    compile project(':SOME_PROJECT')

    defaults "OTHER_PROJECT_1:${VER}@zip"
    defaults project(':OTHER_PROJECT_2').files('WEB')
}

in no matter in which order i will add defaults dependencies all files are overritten by "OTHER_PROJECT:${VER}@zip". I have multi project build. My question is how can i define defauts to be somehow ordered list (the order is specified by order of addition)?

  • Configurations don't give any guarantees around file ordering. How did you verify that changing the order doesn't make a difference? Did you print the configurations' files? And why do you get some files for OTHER_PROJECT from a repository, and some from the project? Seems smelly. – Peter Niederwieser Oct 06 '14 at 12:11
  • Yes. I understand why you say smelly :D but... we don't have any choice. We have 2 other projects which depends on the same - common proj. - which holds commons jsp files and many others (like js/css and so on). We make/do many changes in many files and we cannot store so many versions of these common project on nexus and remeber to add correcto version in dependand project. – user292148 Oct 06 '14 at 12:18
  • I see a miskate here it should be something like this defaults "OTHER_PROJECT_1:${VER}@zip" defaults project(':OTHER_PROJECT_2').files('WEB') – user292148 Oct 06 '14 at 12:19
  • How did you verify that changing the order doesn't make a difference? Did you print the configuration's files? `task debug << { configurations.defaults.each { println it } }` – Peter Niederwieser Oct 06 '14 at 12:23
  • Like you've wrote - using task debug << { configurations.defaults.each { println it } } – user292148 Oct 06 '14 at 12:26
  • And what's the outcome? If the order doesn't change, you'll have to try something different, e.g. use separate configurations. Or you remove the need for having a specific order. – Peter Niederwieser Oct 06 '14 at 12:54
  • One solution that I've tried is that `task extractDefaults(type: Copy) { from { configurations.defaults.collect { it.isDirectory() ? new LinkedList() : zipTree(it) } } from { configurations.defaults.collect { it.isDirectory() ? it : new LinkedList() } } into "$buildDir/defaults/" }` but it is a litle bit messy i think – user292148 Oct 06 '14 at 13:03

0 Answers0