Copying the Gradle cache to another machine

I have the similar problem to steven.dick, however I didn’t understand the solution. Project configuration files which are well executable on PC (it will be PC-1) with internet access. (By the way PC has to have internet access and configured VPN in order to have posibillity download the libs from external repository). So, I copied cache files from PC-1 to PC-2(without internet access) and lanched gradle in offline mode, but I got this error: --------------------------------------------------------------------------------------------------------------------------------------------------

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring root project ‘MyProject’. > Could not resolve all dependencies for configuration ‘:classpath’.

Could not download artifact ‘org.jfrog.buildinfo:build-info-extractor-gradle:2.0.9:build-info-extractor-gradle.jar’

Could not download artifact ‘org.jfrog.buildinfo:build-info-extractor-gradle:2.0.9:build-info-extractor-gradle.jar’:

No cached version available for offline mode

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.305 secs

-------------------------------------------------------------------------------------------------------------------------------------------------- I checked ~/.gradle dir and saw that build-info-extractor-gradle.jar file exist. What I have to do in order to resolve this exeption?

And my configuration files in MyProject folder are:

  • build.gradle:
apply plugin: "java" // enables compile configuration
  apply from: 'project.gradle'
  buildscript {
 repositories {
  mavenLocal()
  maven {
   url 'http://external-server.com:8081/artifactory/plugins-release'
   credentials {
    username = "${artifactory_user}"
    password = "${artifactory_password}"
   }
  }
     }
 dependencies {
  classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.0.9')
 }
}
  allprojects {
 apply plugin: 'artifactory'
}
  artifactory {
 contextUrl = "${artifactory_contextUrl}"
 //The base Artifactory URL if not overridden by the publisher/resolver
 publish {
  repository {
   repoKey = 'libs-release-local'
   username = "${artifactory_user}"
   password = "${artifactory_password}"
   maven = true
       }
 }
 resolve {
  repository {
   repoKey = 'libs-release'
   username = "${artifactory_user}"
   password = "${artifactory_password}"
   maven = true
       }
 }
}
  • project.gradle
defaultTasks 'installMyProjectDependencies'
  def MyProjectPackages = [
 [name: "merchandiseStoreFront",
 target: "MyProject/bin/custom/merchandise/merchandisestorefront/lib",
 dependencies: [
 "net.sf.ezmorph:ezmorph:1.0.6",
 "org.apache.httpcomponents:httpclient:4.1.3",
 "org.apache.httpcomponents:httpcore:4.1.4",
 "org.codehaus.jackson:jackson-core-asl:1.9.11",
 "org.codehaus.jackson:jackson-mapper-asl:1.9.11",
 "jaxen:jaxen:1.1.3",
 "org.json:json:20080701",
 "net.sf.json-lib:json-lib:2.4:jdk13",
 "org.seleniumhq.selenium:selenium-android-driver:2.16.1",
 "org.seleniumhq.selenium:selenium-api:2.16.1",
 "org.seleniumhq.selenium:selenium-iphone-driver:2.16.1",
 "org.seleniumhq.selenium:selenium-remote-driver:2.16.1"
 ]],
 [name: "merchandiseStoreFrontWeb",
 target: "MyProject/bin/custom/merchandise/merchandisestorefront/web/webroot/WEB-INF/lib",
 dependencies: [
 "com.granule:granule:1.0.9",
 "atg.taglib:json-taglib:0.4.1",
 "org.jsoup:jsoup:1.7.2",
 "javax.servlet.jsp.jstl:jstl-api:1.2",
 "org.glassfish.web:jstl-impl:1.2",
 "org.springframework.security:spring-security-taglibs:3.1.1.RELEASE",
 "org.springframework:spring-webmvc:3.1.1.RELEASE"
 ]],
 [name: "webServices",
 target: "MyProject/bin/custom/webservices/lib",
 dependencies: [
 "net.sf.kxml:kxml2:2.1.8",
 "xpp3:xpp3:1.1.4c",
 "oro:oro:2.0.8",
 "org.jsoup:jsoup:1.7.2",
 "org.codehaus.groovy.modules.http-builder:http-builder:0.6",
 "org.apache.httpcomponents:httpclient:4.2.1",
 "org.apache.httpcomponents:httpcore:4.2.1",
 "net.sf.json-lib:json-lib:2.3:jdk15@jar",
 "xml-resolver:xml-resolver:1.2",
 "net.sourceforge.nekohtml:nekohtml:1.9.16",
 "xml-resolver:xml-resolver:1.2"
 ]],
 [name: "webServicesWeb",
 target: "MyProject/bin/custom/webservices/web/webroot/WEB-INF/lib",
 dependencies: [
 "org.codehaus.jettison:jettison:1.3",
 "javax.ws.rs:jsr311-api:1.1.1",
 "javax.servlet:jstl:1.2",
 "org.springframework.security.oauth:spring-security-oauth2:1.0.1.RELEASE",
 "org.springframework.security:spring-security-taglibs:3.1.1.RELEASE",
 "org.springframework:spring-webmvc:3.1.1.RELEASE",
 "com.thetransactioncompany:cors-filter:1.3.2",
 "com.thetransactioncompany:java-property-utils:1.9",
 "javax.xml.stream:stax-api:1.0-2",
 ]],
 [name: "ngrestservices",
 target: "MyProject/bin/custom/ngrestservices/web/webroot/WEB-INF/lib",
 dependencies: [
 "javax.servlet:jstl:1.2",
 "com.fasterxml.jackson.core:jackson-core:2.1.1",
 "com.fasterxml.jackson.core:jackson-databind:2.1.1",
 "com.fasterxml.jackson.core:jackson-annotations:2.1.1",
 "org.springframework:spring-webmvc:3.1.1.RELEASE",
 "org.apache.commons:commons-lang3:3.1",
 "org.codehaus.groovy.modules.http-builder:http-builder:0.6",
 "net.sf.json-lib:json-lib:2.3:jdk15@jar",
 "org.apache.httpcomponents:httpclient:4.2.1",
 "org.apache.httpcomponents:httpcore:4.2.1",
 "xml-resolver:xml-resolver:1.2",
 //"xerces:xercesImpl:[2.6.2,)",
 "net.sourceforge.nekohtml:nekohtml:1.9.16",
 "org.springframework.security.oauth:spring-security-oauth2:1.0.1.RELEASE",
 "org.springframework.security:spring-security-taglibs:3.1.1.RELEASE",
        "com.nastygal:nastycommon:0.0.10"
 ]],
 [name: "ngfulfilmentprocess",
 target: "MyProject/bin/custom/ngfulfilmentprocess/lib",
 dependencies: [
 "org.apache.httpcomponents:httpclient:4.2.1",
 "org.apache.httpcomponents:httpcore:4.2.1",
        "com.nastygal:nastycommon:0.0.10"
 ]],
 [name: "merchandiseCore",
 target: "MyProject/bin/custom/merchandise/merchandisecore/lib",
 dependencies: [
 "net.sourceforge.cssparser:cssparser:0.9.11",
 "net.sourceforge.htmlunit:htmlunit:2.13",
 "net.sourceforge.htmlunit:htmlunit-core-js:2.13",
 "net.sourceforge.nekohtml:nekohtml:1.9.19",
 "org.apache.commons:commons-lang3:3.1",
 "org.apache.commons:commons-exec:1.1",
 "org.apache.httpcomponents:httpclient:4.3.1",
 "org.apache.httpcomponents:httpcore:4.3",
 "org.apache.httpcomponents:httpmime:4.1.3",
    "org.json:json:20131018",
 "org.seleniumhq.selenium:selenium-firefox-driver:2.39.0",
 "org.seleniumhq.selenium:selenium-api:2.39.0",
 "org.seleniumhq.selenium:selenium-remote-driver:2.39.0",
 "org.seleniumhq.selenium:selenium-support:2.39.0",
 "xerces:xercesImpl:2.11.0"
   ]],
 [name: "ngemail",
 target: "MyProject/bin/custom/ngemail/lib",
 dependencies: [
 "org.apache.httpcomponents:httpclient:4.2.1",
 "org.apache.httpcomponents:httpcore:4.2.1"
         ]],
 [name: "ngacceleratorservices",
 target: "MyProject/bin/custom/ngacceleratorservices/lib",
 dependencies: [
 "org.apache.commons:commons-lang3:3.1",
 "com.paypal.sdk:paypal-core:1.4.1",
 "com.paypal.sdk:merchantsdk:2.3.101",
 "com.google.code.gson:gson:2.2.2"
 ]],
 [name: "braintree",
 target: "MyProject/bin/custom/braintree/lib",
 dependencies: [
 "com.braintreepayments.gateway:braintree-java:2.29.0"
 ]]
]
  configurations {
 MyProjectPackages.each { pkg ->
  add(pkg.name)
  configurations[pkg.name].transitive = false
 }
}
  /*
  * Dependencies are downloaded to...
 * /Users/${your_username}/.gradle/caches/artifacts-15/filestore
 */
dependencies {
 MyProjectPackages.each { pkg ->
   pkg.dependencies.each { dep ->
    add(pkg.name, dep)
  }
 }
}
  /*
  * Create copy task for each MyProject package. These will be
 * declared as dependencies for the installMyProjectDependencies task.
 */
MyProjectPackages.each { pkg ->
 tasks.add(
  task(pkg.name, type: Copy) {
   from(configurations[pkg.name])
   into(pkg.target)
  }
 )
}
  /*
 * gradle installMyProjectDependencies
 *
 * Use this task to initialize a new MyProject installation with the required jars
 * for all custom extensions. The jars for the MyProject platform and base
  * extensions should be installed from the zip file downloaded from the MyProject
 * site.
Additionally, in order to keep dependencies upto date and free of
  * stale/unused artifacts, this tasks depends on cleanMyProjectDependencies.
  */
task installMyProjectDependencies(
  dependsOn:
['a_cleanMyProjectDependencies'] +
      MyProjectPackages.collect{ pkg -> pkg.name }
) << {}
  /*
 * gradle cleanMyProjectDependencies
 *
 * Deletes all jar files from the configured MyProjectPackages.
 */
task a_cleanMyProjectDependencies << {
 // The Gradle Delete task does not handle wildcards, so I am using antbuilder.
 // See http://gradle.1045684.n5.nabble.com/Delete-with-wildcard-td4550586.html.
 ant.delete(includeEmptyDirs: 'false', quiet: 'true') {
  MyProjectPackages.each { pkg ->
    fileset(dir: file(pkg.target), includes: '*.jar')
  }
 }
}

Conf file gradle.properties in ~/.gradle folder contains:

artifactory_user=my_name
artifactory_password=my_password
artifactory_contextUrl=http://external-repository.com:8081/artifactory

And system variable in PC-1 and PC-2 are the same:

D:\growthHub\apache-maven-3.1.1\bin;
D:\growthHub\gradle-1.11\bin;
D:\growthHub\apache-ant-1.9.3\bin;