Is the definition of the source files using from() of a copyspec processed in order?


(rhuberg) #1

I want to create a war from 2 sources. The one source (configurations.webModule) has a higher precedence (i.e. use the files there instead of the alternative because they are newer). I am creating a new WAR starting from a particular release, but want the new version to have updated artifacts.

Does the order of the from() closures matter? I thought I read from a stackoverflow forum that they were NOT and there was no way to specify an order.

task packageWar(type: War, group: dependsOn: [
        configurations.originalApplication,
        configurations.webModule
    ]) {
        archiveName='My.war'
        classifier = 'archives'
        duplicatesStrategy DuplicatesStrategy.EXCLUDE
        from { configurations.webModule } { into 'WEB-INF/lib' } // latest artifacts
        from {
            configurations.originalApplication.collect { // older artifacts - do not use these if present in the webModule configuration above
                (it.exists()) ? zipTree(it) : it
            }
        }
    }