Hi Walter,

On May 14, 2009, at 6:50 PM, Walter Di Carlo wrote:

Hi,

I am using a flat repository to store all jars needed by the
dependency resolver. Now, I am trying to implement a task which
updates the lib folders of all sub-projects.

In the subproject section I have created the following task. The idea
is to check the date of the libraries to see if a copy from the
repository to the project lib folder is needed.


 createTask('update_lib', dependsOn: 'archive_jar') { task ->
   if( isProjectPresent( task.project.name ) ) {
     deps = task.project.dependencies.resolve('compile', true, true )

     deps.each { resolveFile ->
       repoFile = new File( mainRepo.path+"/"+resolveFile.getName()  )
       libName = repoFile.getName()
libFile = new File( task.project.buildDir.path+"/../ lib/"+libName )
       if( libFile.exists() == true ) {
         repoDate = repoFile.lastModified()
         libDate = libFile.lastModified()
         if( repoDate <= libDate ) {
           return
         }
       }
       ant.copy( file: repoFile, todir:
task.project.buildDir.path+"/../lib", overwrite:true)
     }
   }
 }

my problem is that the line

     deps = task.project.dependencies.resolve('compile', true, true )

does not contain the dependencies between projects. I mean, for each
project I have used the following in the dependency section

                if( isProjectPresent( "prjA" ) == true )
                        compile project(':prjA')
                else
                        compile "prjA:prjA:jar"

it seems deps contains only the jars specified without the project
dependency, i.e

                        compile "prjA:prjA:jar"

Note that I am using Gradle 0.5.2 and that I am using
resolve('compile', true, true ) which should include also the project
dependencies if I have understood its meaning declared in the
documentation

java.util.List<java.io.File> resolve(java.lang.String conf,
boolean failForMissingDependencies, boolean includeProjectDependencies)

   Returns a list of file objects, denoting the path to the classpath
elements belonging to this configuration.

   Parameters:
       failForMissingDependencies - If this method should throw an
exception in case a dependency of the configuration can't be resolved
       includeProjectDependencies - Whether project dependencies
should be resolved as well.
   Returns:
       A list of file objects


Any hints? Thanks

This is a bug. We will release 0.6 probably early next week. With 0.6 you have nicer ways to solve scenarios like the one above. But it will also breaks your code.

- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org





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

   http://xircles.codehaus.org/manage_email


Reply via email to