Cannot instantiate ivy classes


(Aram Mirzadeh) #1

What am I doing wrong here? The ultimate goal is to download *.properties from the URL.

[ I know resolver is not needed, was just trying out to see if there was a class name issue.

Error:

    build file '/home/awm/t/build.gradle': 13: unable to resolve class org.apache.ivy.plugins.resolver.URLResolver 
   @ line 13, column 20.
         def resolver = new org.apache.ivy.plugins.resolver.URLResolver()
                        ^
  
  build file '/home/awm/t/build.gradle': 14: unable to resolve class org.apache.ivy.util.url.ApacheURLLister 
   @ line 14, column 21.
         def urlLister = new org.apache.ivy.util.url.ApacheURLLister()
                         ^

Code:

plugins {
    id "de.undercouch.download" version "2.0.0"
}

import de.undercouch.gradle.tasks.download.Download
import org.apache.ivy.util.url.*

task downloadDirectory {
    def dir = 'http://127.0.0.1:8081/artifactory/gradle-local/props/'
    def resolver = new org.apache.ivy.plugins.resolver.URLResolver()
    def urlLister = new org.apache.ivy.util.url.ApacheURLLister()
    def files = urlLister.listFiles(new URL(dir))
    download {
       src files
       dest "lib"
    }
}

defaultTasks 'downloadDirectory'

(Jan Mewes) #2

Just for the records:

The custom ivy resolver plug-in is deprecated.

See Custom ivy resolver deprecation in gradle 2.x?