I am trying to download the artifact from nexus to my local directory using gradle task.I have to pass username/password in my gradle task to downlaod the artifact.Below is my Gradle Task
task downloadFile(type: MyDownload) {
sourceUrl = 'http://localhost:8081/xxx/xxx/xxx'
target = new File('E:/bookstore/', 'build.zip')
}
class MyDownload extends DefaultTask {
@Input
String sourceUrl
@OutputFile
File target
@TaskAction
void download() {
ant.get(src: sourceUrl, dest: target)
}
}
I am able to access with this task when i remove authorization in nexus but i need to enable authorization in nexus and pass the credentials through Gradle task