I'm trying to get a Java programming project set up in a way that it can be built completely offline just from the files in version control, on any machine, with no prerequisites to install. (Sole exception: the JDK)
I don't know much of Maven, but I'm learning Gradle currently. For the build I'm using Gradle with the wrapper, I modified the
gradle-wrapper.properties so the
distributionUrl doesn't point to a remote URL but instead a file within the project's folder. So Gradle itself is done already.
For dependencies though, this is a pure nightmare. I've already tried managing it with simply directly pointing to single JARs or collections of JARs, but as you sure know this ends up in total confusion if you have interdependencies and/or transitive dependencies.
Basically what I want to have is Gradle/Maven configured (just for this project) in such a way that they use a different directory for their local dependency cache - not one that is shared by anything you do on your user account, in your home directory, but instead a folder within the project folder (so I can check that into version control as well) which is only used for that one project. I would then only once take Gradle/Maven in online mode, run the build once to download all the currently needed dependencies into the local cache directory within the project folder (whose contents then are put into VC), then put it in offline mode for all subsequent builds.
I haven't found a way yet to reconfigure that local cache path just for this one project (has to be something I can just put into my
build.gradle). Anyone have a lead for me?
Edit: Another thing would be to have this local repository within the project folder be a "real" Maven repository (instead of just a cache). But that would involve manual work for one way I imagined: You start a local copy of Sonatype Nexus that has a proxying repository set up for any Maven repos you're referring to in your
build.gradle; you modify the repo URLs in your build script to point to your local Nexus, run the build once so Nexus downloads the deps and puts them into its work directory in the "usual" Maven repo structure; then you copy that structure to a folder within your project folder and change the buildscript repo URLs to point to the folder you just copied the files to. Quite a lot of work that can barely be automated.