I need to deploy my code to another machine. How do I export the dependent jars to a lib directory?
At runtime, Gradle will locate the declared dependencies if needed for operating a specific task. The dependencies might need to be downloaded from a remote repository, retrieved from a local directory or requires another project to be built in a multi-project setting. This process is called dependency resolution.
implementation configuration is used for compile and runtime classpath but it is only exposed to the consumers for their runtime classpath. runtimeOnly configuration is only used for the runtime classpath and it is also exposed to the consumers for their runtime classpath.
Dependency ordering is preserved, but for example all compile dependencies will be before testCompile dependencies no matter of how you order them. Depending on the nature of your conflict you could also exclude the dependency from 'testCompile' rather than force the correct one higher on the classpath.
Here is the way to do it with Gradle 2.x:
task copyToLib(type: Copy) {
// into "build/lib"
into "lib"
from configurations.classpath
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With