Hi I want to run a few test made with cucumber on a gradle project, I was trying to run this test\'s on another PC (with limited network access) so I copy/pasted everything
See this open Gradle issue
Gradle cache isn't exactly portable currently. It does work, if the absolute path of the .gradle folder is exactly the same on both machines. The absolute path of ~/.gradle
is not the same if the username on both machines is different!
There are a few ways you can get around this, in order of effort required, least to most:
--offline
onceIf this is possible on your network limited machine, run without offline flag once, the dependencies will not be downloaded again, but checksums are - and more importantly the cache is now validated and suitable for use with the --offline
flag.
.gradle
to a repeatable pathMove gradle cache folder to something like /tmp/.gradle
by setting GRADLE_USER_HOME
on both machines and then copy gradle cache between machines.
On the network connected machine, use a gradle task to export all dependencies to a filesystem folder. Copy the folder over to the other machine, and use a flatdir repo on the second machine.
repositories {
flatDir {
dirs 'lib' //folder containing dependencies
}
}
(You could also export to a maven format repo instead of flatdir. See https://stackoverflow.com/a/13396776/1174024)
In my experience Maven's .m2 folder is far more portable. Create a maven project with the same dependencies, cache dependencies into .m2 and then copy .m2 over to the second machine. On the second machine add mavenLocal()
as a repo.