I have a new project, it depends on classes at legacy project, not jar files but actual classes. How can I make these directories a dependency for gradle compile?
Asked
Active
Viewed 4.3k times
1 Answers
43
dependencies {
compile files("relative/path/to/classes/dir")
}
For further details, check out the Gradle User Guide.

Peter Niederwieser
- 121,412
- 21
- 324
- 259
-
This seems add all files in that directory into the classpath as jar files. Can we just add a folder? I have the same problem. – zggame Jan 29 '15 at 17:33
-
This adds the specified directory to the class path, which effectively adds all class files (not Jar files) contained in that directory. This is what the OP asked. – Peter Niederwieser Jan 29 '15 at 22:26
-
You are correct. This adds the directory instead of the file of the directory. `fileTree()` add all the files of the folders (recursively) I think. I am confused with it. Thank you very much. – zggame Jan 30 '15 at 21:48
-
2
-
-
`classpath` is only used for buildscript dependencies. Also, `compile` is now deprecated in favor of `api|implementation`. – Ajax Nov 03 '18 at 09:31