Gradle custom plugin load dependency


(Alan Lee) #1

Now, i have written the task in the build.gradle, it works but now i want to put that task into the custom plugin. And it doesn’t work.

In fact, the compile is not .jar. It is a zip files with dependency in maven. My purpose is to download all the related zip files and unzip only.

Do you have any idea on how to download/depends on the file ?

The current build.gradle

dependencies {

compile group: “com.test.a”, name: ‘basic’,version: ‘1.0.1’

compile group: “com.test.a”, name: ‘basic1’, version: ‘1.0.1’

}

task ABC << {

files(project.configurations.compile.getFiles()).each {

//handle all zip files

}

}

Inside the Plugin1.groovy

class Plugin1 implements Plugin {

@Override

public void apply(Project project) {

project.dependencies.add(‘compile’, ‘com.test.a:basic1:1.0.1’);

project.dependencies.add(‘compile’, ‘com.test.a:basic:1.0.1’);

}

}