Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 directory?

like image 896
Joshua Avatar asked Oct 06 '10 12:10

Joshua


People also ask

How Gradle download dependencies?

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.

What is runtimeOnly in gradle?

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.

Does order of dependencies matter in gradle?

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.


1 Answers

Here is the way to do it with Gradle 2.x:

task copyToLib(type: Copy) {
    // into "build/lib"
    into "lib"
    from configurations.classpath
}
like image 119
djangofan Avatar answered Oct 06 '22 01:10

djangofan