开发者

How do I export the dependent libraries to a directory for deployment in gradle?

开发者 https://www.devze.com 2023-01-19 02:36 出处:网络
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:

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
  }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号