0

I am using org.ajoberstar.grgit in my module level build.gradle like this:

plugins {
  id "org.ajoberstar.grgit" version "1.5.0"
}

ext {
  Grgit = org.ajoberstar.grgit.Grgit
}
// Some more code

My top-level build.gradle looks like this:

subprojects {
  repositories {
      mavenCentral()
  }
  apply plugin: 'java'

  apply plugin: 'eclipse'

  apply plugin: 'idea'
}

The build is executed properly. If I execute it for the first time, it downloads the required files from https://plugins.gradle.org/m2/. I guess this information is coming from the plugin block in the module level build.gradle and download is facilitated by the mavenCentral() command. Also, the files get saved in ~/.gradle/caches/3.4.1 and for subsequent builds, the IDE(Intellij IDEA) uses this location only. My question is that can I download the files to some other places manually and then make the IDE to pick up them from that location?

Ankit Shubham
  • 2,989
  • 2
  • 36
  • 61
  • Let me know if this works add following into your settings.gradle file `buildCache { local { // Set local build cache directory. directory = "${settingsDir}/build-cache" } }` – dkb Jan 03 '19 at 12:21
  • It did not work. It gave following error: `Could not find method buildCache() for arguments [settings_8vf83wfau80qqvi5syqks94zv$_run_closure1@5eb3e372] on settings 'java' of type org.gradle.initialization.DefaultSettings.` – Ankit Shubham Jan 03 '19 at 12:31
  • on settings.gradle `pluginManagement { repositories { gradlePluginPortal() } }` ref: https://docs.gradle.org/current/userguide/plugins.html#sec:custom_plugin_repositories, along with 1 above changes – dkb Jan 03 '19 at 12:34
  • It did not work either. It failed with the following error: `Could not find method pluginManagement()` – Ankit Shubham Jan 03 '19 at 13:02
  • My gradle is 3.4.1. I guess this is too old? – Ankit Shubham Jan 03 '19 at 13:02
  • sorry for trial and error: `$gradle -g /some/other/dir build`, ref: https://docs.gradle.org/current/userguide/command_line_interface.html – dkb Jan 03 '19 at 13:08
  • you can change GRADLE_HOME in intelliJ idea as shown in image: https://stackoverflow.com/a/53120932/2987755 – dkb Jan 03 '19 at 13:14
  • I think pluginManagement is not present in 3.4.1. I will upgrade it to 5.0.+ and see if it works then. – Ankit Shubham Jan 03 '19 at 13:24
  • you can ignor `pluginManagement()` changes for $gradle -g /some/other/dir build and give it a try – dkb Jan 03 '19 at 13:28

0 Answers0