How do I export the dependent libraries to a directory for deployment in gradle?
I need to deploy my code to another machine. How do I export the dependent jars to a lib di开发者_如何转开发rectory?
Here is the way to do it with Gradle 2.x:
task copyToLib(type: Copy) {
// into "build/lib"
into "lib"
from configurations.classpath
}
I am not sure if this is the correct way, but to copy the jars to a lib directory I do the following:
/**
* Copies the dependencies to the lib directory in preparation for them to be added to a jar file
*/
task copyRuntimeDependencies(dependsOn: configurations.runtime.buildArtifacts, type: Copy)
{
into('build/output/lib')
from configurations.runtime
from configurations.runtime.allArtifacts*.file
}
精彩评论