I'm no expert but I've done similar to generate classpaths, build distro
zips, etc.... in my experience, you shouldn't need the configurations {}
section. You will still need it in the task itself.
Did you have a problem when not using that section? The only other
major difference I can see between my code and yours is the
'configuration-time' versus 'execution-time' issue.
For example, my task might have been written as:
task print_dependencies(dependsOn: assemble) << {
configurations.compile.files.each { file ->
println "$file.name <http://file.name> -> $file.path"
}
}
Actually, in case it helps, here is an example of a plug-in I use to
generate a windows setclasspath script:
http://filament.svn.sourceforge.net/viewvc/filament/trunk/gradle-plugins/setclasspath.gradle?revision=431
Again, I don't know if it's the best way. Would also be curious to know
if there are better ways, actually. But at least I didn't need to put a
redundant 'configurations' section.
-Paul
Alessandro Novarini wrote:
Hello list,
This is my first message here, sorry if my question is going to be naive.
I'm trying to get the dependencies of a project so that I can copy them
in my package; the test I'm running now is just to print their path.
What I did is the following:
apply plugin: 'java'
repositories {
mavenCentral()
}
configurations {
compile
}
dependencies {
compile group: 'commons-digester', name: 'commons-digester',
version: '2.1', transitive: true
}
task print_dependencies(dependsOn: assemble) {
configurations.compile.files.each { file ->
println "$file.name <http://file.name> -> $file.path"
}
}
The question is: how I can get rid of the "configurations" section? I
mean, isn't it a sort of duplication with the dependencies section?
I tried to use dependencies.compile.files.each but gradle told me that
the compile property wasn't found.
Any advice? Is there a better method to do it?
Thank you in advance
Ale
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email