gradle 复制依赖的jar到指定目录

task copyJars(type: Copy){

   from configurations.runtime

    into "$buildDir/ libs/deps"

}

 

compileJava.dependsOn copyJars

 

// 设置java程序入口

jar{

    manifest{

        attributes("Main-Class" : "xxx.xxx.App")

        attributes("Class-Path": configurations.compile.collect { "deps/$it.name" }.join(' '))

    }

}

猜你喜欢

转载自study121007.iteye.com/blog/2324068