This setup works for me.
ext.scripts = [
idea: dependencies.create(group: 'ca.jptech.gradle.scripts', name: 'idea', version: '1', ext: 'gradle'),
javafx7: dependencies.create(group: 'ca.jptech.gradle.scripts', name: 'javafx7',version: '1', ext: 'gradle')
]
allprojects {
//...snip...
configurations {
gradleScripts
}
dependencies {
gradleScripts scripts.idea
gradleScripts scripts.javafx7
}
apply from: configurations.gradleScripts.fileCollection(scripts.idea).singleFile
}
However, this setup fails.
ext.scripts = [
idea: dependencies.create(group: 'ca.jptech.gradle.scripts', name: 'idea', version: '1', ext: 'gradle'),
javafx7: dependencies.create(group: 'ca.jptech.gradle.scripts', name: 'javafx7',version: '1', ext: 'gradle')
]
allprojects {
//...snip...
configurations {
gradleScripts
}
// The following line causes the build to fail
scripts.each { dependencies.gradleScripts it }
apply from: configurations.gradleScripts.fileCollection(scripts.idea).singleFile
}
The commented line causes my build to fail with the error:
Cannot convert the provided notation to an object of type Dependency: idea=DefaultExternalModuleDependency{group='ca.jptech.gradle.scripts', name='idea', version='1', configuration='default'}.
I can’t figure out why. I must be misunderstanding something because I thought both setups would do the exact same thing.