On 30/09/2010, at 1:05 AM, 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 -> $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?
Not at the moment. After the Gradle 0.9 release is finished, we plan to rework
the dependency DSL a bit. The configurations { } section will probably go away,
and be merged into dependencies { } and artifacts { }. We're not entirely sure
how this will look yet. One option is that when you do
dependencies {
compile 'somedep'
}
then this will implicitly create the 'compile' configuration if it does not
exist. Or, alternatively, we might give you some way to declare new
configurations in the dependencies { } section.
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz