This helped me very much, Thank You!
Two more things:
1) I need is to remove versions from file names. The only way a found is
this:
project.subprojects.collect {
it.configurations.each { Configuration config ->
Configuration extConfig =
config.copyRecursive(DependencySpecs.type(Type.EXTERNAL))
extConfig.allDependencies.each { Dependency dependency
->
extConfig.each { File file ->
if(file.name.contains("${dependency.name}-${dependency.version}")){
project.logger.info("Copying ${file.path} to
${project.rootLibDir}/${dependency.name}.jar...")
File targetFile = new
File("${project.rootLibDir}/${dependency.name}.jar")
project.ant.copy(file: file.path, toFile:
targetFile.path)
}
}
}
}
}
Doesn`t look good. Any ideas?
2) What does subprojects.collect{} means? Didn`t found it in API.
3) Also I want to do the same for every module to have module/lib/*.jar. It
works just by setting other "targetFile" but the problem is, that only first
level module dependencies are copied. I want to have there all external libs
from all current module dependency modules.
Adam Murdoch-2 wrote:
>
>
>
> Narco wrote:
>> I need to take all third party artefacts from multi-project and copy to
>> one
>> folder to use them with IDE afterthen. This means I don`t need
>> compilation
>> or anything else there. From APIs I found that this should work:
>> configurations {
>> compile
>> localArchives.extendsFrom (compile)
>> localArchives.exclude(group: 'my.company.group')
>> }
>>
>> However, when calling localArchives.allDependencies from some task gradle
>> still tries to resolve internal modules from repository so exclude is
>> ignored. For now I have dirty hack:
>> project.configurations {
>> compileLib
>> compile.extendsFrom (compileLib)
>> testCompileLib
>> testCompile.extendsFrom (testCompileLib)
>> localArchives.extendsFrom (compileLib, testCompileLib)
>> }
>>
>> Please help me to make it good looking with only one additional
>> configuration or none at all.
>>
>
> Here is an example task you can add to the root project. It will copy
> all the external dependencies for all subprojects into the 'libs'
> directory. It doesn't need any extra configurations, nor will it try to
> build any project dependencies.
>
> task libs(type: Copy) {
> File libsDir = file('libs')
> doFirst {
> ant.delete(dir: libsDir)
> }
> into libsDir
> // you might want the testCompile or testRuntime configuration instead
> from { subprojects.collect {
> it.configurations.runtime.copyRecursive(DependencySpecs.type(Type.EXTERNAL))
> } }
> }
>
>
> --
> Adam Murdoch
> Gradle Developer
> http://www.gradle.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
>
--
View this message in context:
http://old.nabble.com/How-to-get-only-third-party-libs-from-dependencies-tp26588195p26624463.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