0

I have a hierarchical directory of jars that I am looking to add to my buildscripts classpath. I have written a task that compiles all the jars into a list, however I am at a loss when trying to apply them to the classpath. Has anyone encountered this before? Any help would be much appreciate.

The snippet of my code follows:

import groovy.io.FileType

buildscript {

    repositories {

    }

    dependencies {

    }
}

task classpaths << {

    def list = []
    def dir = new File("/usr/local/foo/bar/packages")
    dir.eachFileRecurse (FileType.FILES) { file->
        if (file.isFile() && file.name.endsWith("jar")) {
            list << file
        }
    }

}
  • Think http://stackoverflow.com/a/23897638/6509 covers your issue – tim_yates Jun 29 '15 at 13:42
  • 1
    @tim_yates That actually doesn't answer my question as I wanted to reecursively access all files in the directory. I actually just found the answer. `dependencies { compile fileTree(dir: 'foobar', include: '**/*.jar') }` – Benjamin Weis Jun 29 '15 at 13:56
  • Sorry, duplicate of http://stackoverflow.com/a/16285120/6509 then instead – tim_yates Jun 29 '15 at 16:09

0 Answers0