Copy Dependencies from Repository to Folder


(Peter) #1

Hi,

my buildscript builds a multiproject. After the build i want to copy some dependencies from my repository to a specific folder.
Therefor I created a sperate task(outside of the subprojects Node), because this task should only run once.

task parseXml() {
doLast
{
parsedProjectXml.plugin.each{ plugin ->
println ‘XML: ’ + plugin.@id
if(!arraySub.contains(plugin.@id))
{
println ‘Found: ’ + plugin.@id
configurations.release.getDependencies().add(’${project.ext.eclipseMavenGroup}:’ + plugin.@id + ‘:+’)
}
}
}
}

I get the following error: Could not find property 'release' on configuration container.

I created the configuration with (inside subprojects Node):

configurations { release }

My plan was to copy all the dependencies from the release configuration to the folder.
How can i add dependencies to a configuration or is there a better way to solve my task?


(Lance Java) #2

It’s hard to know without seeing the rest of your script but I’m guessing you need to reference the configuration from another project.

evaluationDependsOn(':someOtherProject')
task parseXml() {
   ...
   doStuff(project(':someOtherProject').configurations.release)
}

(Peter) #3

Ok that worked, but can i create a configuration that is not depend of any subproject? Or is there another way to copy the libs from the repository?


(Lance Java) #4

I have no idea what you are doing!!! perhaps you want

task parseXml() {
   FileCollection allFiles = files()
   subprojects.each { p ->
      if (p.configurations.findByName('release')) {
         allFiles.add(p.configurations.release)
      }
   }
   doStuff(allFiles)
}