Narco wrote:
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?
The Copy task has a rename() method. You could use that:
task libs(type: Copy) {
....
rename('(.+)-\\d+(\\.\\d+)*(\\.\\w+)', '$1$3')
}
2) What does subprojects.collect{} means? Didn`t found it in API.
The collect() method is something groovy adds to Collection. Have a look
at http://groovy.codehaus.org/groovy-jdk/
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.
I don't think there's an easy way to do this. Could you add a JIRA issue?
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
--
Adam Murdoch
Gradle Developer
http://www.gradle.org