I am trying to do this from within a task defined in the subprojects{}
section.  For now, before I get too excited about generating xml, I just
want it to print out the resolved files.  When I add this task to the
subprojects section:
    createTask('cpGenXML', dependsOn: 'compile'){
        println 'Project ' + project.name + ' getting resolved
dependencies...'
        dependencies.resolve('compile').each {file->
            println 'File ' + file.name + ' resolved.'
        }
    }
The resulting output is:
Executing: :compile
Executing: :project1:cpGenXML
Project project2 getting resolved dependencies...
File proj2dep1.jar resolved.
File proj2dep2.jar resolved.
etc...
Executing: :project2:cpGenXML
Project project2 getting resolved dependencies...
File proj2dep1.jar resolved.
File proj2dep2.jar resolved.
etc...

It is supposed to be doing this for each project individually, but the
context is having a problem and it is getting project2's dependency list no
matter which project it is executing the task from.  Am I declaring this
task wrong or in the wrong section?  In the end, I'm going for a task that
operated the same for eac project, taking the list of that project's
resolved dependencies and generating some xml.  Note: project2 depends on
project1.

hdockter wrote:
> 
> 
> On Jun 10, 2008, at 3:59 PM, JerodLass wrote:
> 
>>
>> In the meantime, is there a way to access a list of dependencies I've
>> declared as objects (and work with them within a gradle task)?
> 
> You can write in any task for example:
> 
> dependencies.resolve('compile')
> 
> which returns a list of File objects pointing to the resolved  
> dependencies.
> 
> - Hans
> 
>> Right now, it
>> looks like I'll have to run a script on the gradlefile to convert  
>> compile
>> dependencies back to xml format for a .classpath file. The reason  
>> for this
>> is I might add dependencies to a project I'm building with gradle and
>> someone I'm working with may decide to build it with ant since  
>> they're used
>> to it and their IDE is already ant-friendly.
>> -- 
>> View this message in context: http://www.nabble.com/gradlefile- 
>> cleaning--tp17650512p17756151.html
>> Sent from the gradle-user mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
> 
> --
> Hans Dockter
> Gradle Project lead
> http://www.gradle.org
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/gradlefile-cleaning--tp17650512p17758142.html
Sent from the gradle-user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to