Why is this gradle flatDir example not working?

I am completely new to gradle. I put the following build.gradle file together to see how dependencies are retrieved from the flatDir repository. The directory 'localrepo' contains two files 'a.txt' and 'b.txt' and nothing else. When I run the 'gradle dependencies, I get crashes:

:dependencies ------------------------------------------------------------ Root project ------------------------------------------------------------ copytest +--- :a.txt: FAILED \--- :b.txt: FAILED BUILD SUCCESSFUL Total time: 5.506 secs 

Why?

Here is my build.gradle:

 configurations { copytest } repositories { flatDir name: 'localRepository', dirs: 'localrepo' } dependencies { copytest ':a.txt' copytest ':b.txt' } task copyTask(type: Copy) { from configurations.copytest into 'result' } 
+4
source share
1 answer

A flatDir repo uses simple heuristics to turn the name of the dependency module into the searched file name. If you specify :a.txt , Gradle will look for a.txt.jar or, if you have project.version , also for a.txt-theVersion.jar . To add arbitrary files to the configuration instead of declaring a flatDir repo, you can use copytest files("some/path") .

+8
source

All Articles