---
title: "gradle 复制依赖的jar到指定目录"
author: "study121007"
date: "2016-09-12T23:31:10Z"
tags: []
categories: ["开源软件"]
slug: "gradle-jar"
draft: false
lastmod: "2016-09-12T23:31:10Z"
id: 2324068
url: "https://study121007.iteye.com/blog/2324068"
---

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(' '))

    }

 

}