How to download dependencies in gradle

前端 未结 8 1293
暗喜
暗喜 2020-11-30 23:00

I have a custom compile task.

task compileSpeedTest(type: JavaCompile) {
    classpath = files(\'build\')
    source = fileTree(\'src/test/java/speed\')
             


        
8条回答
  •  有刺的猬
    2020-11-30 23:43

    Downloading java dependencies is possible, if you actually really need to download them into a folder.

    Example:

    apply plugin: 'java'
    
    dependencies {
      runtime group: 'com.netflix.exhibitor', name: 'exhibitor-standalone', version: '1.5.2'
      runtime group: 'org.apache.zookeeper',  name: 'zookeeper', version: '3.4.6'
    }
    
    repositories { mavenCentral() }
    
    task getDeps(type: Copy) {
      from sourceSets.main.runtimeClasspath
      into 'runtime/'
    }
    

    Download the dependencies (and their dependencies) into the folder runtime when you execute gradle getDeps.

提交回复
热议问题