For a demo, I’m assuming there’s no internet connection and I want to distribute a self-contained zip file containing the gradle wrapper, source code and project dependencies.
I have largely got this to work by:
Adding in the gradle distribution (gradle-1.2-bin.zip) and referencing it as a local file://etc distributionUrl in gradle-wrapper.properties * Declaring my dependencies as normal then using the following task to copy them to a “libs” directory.
task makelib(type: Copy, dependsOn:classes) {
into "libs"
from configurations.all
}
Change my dependencies to point to:
compile fileTree(dir: 'libs', include: '*.jar')
I would really like the sources/javadoc as well and for the eclipse task to generate a correct config that references the sources.
I’m wondering if this is the correct approach or whether I should try instead a
If I declare my dependencies as normal and use a “flatDir” repository it won’t work because there’s no way to find/resolve transitive dependencies. Perhaps I can zip up my gradle cache? That would be messy because I also use mavenLocal()
You want GRADLE-1989 (which is not implemented yet).
There’s no great solution to this problem at the moment. If you can manage it, the best thing to do is to use a file based maven/ivy repo. This means you need to get this content from somewhere though.
I decided to use my original solution (above). I manually added some of the lib sources into a libs_sources directory and manipulated the eclipse classpath to include them.