gradle / gradle-completion

Gradle tab completion for bash and zsh
MIT License
1.02k stars 131 forks source link

autocomplete failed #37

Closed echiphn closed 6 years ago

echiphn commented 6 years ago

Dear all, after I using settings for build cache server, I've got following issue:

$ __gradle-completion-init 
 (Building completion cache. Please wait)
FAILURE: Build failed with an exception.

* Where:
Script '/path_of_project/buildCacheSettings.gradle' line: 3

* What went wrong:
A problem occurred evaluating script.
> Could not find method buildCache() for arguments [buildCacheSettings_6652z6kngfw6pr3eb8g2zfo4t$_run_closure1@4aac85fa] on settings 'rootProjectName' of type org.gradle.initialization.DefaultSettings.

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

all other gradle comands work properly, no issue. But without gradle autocomplete is hard to tip all those long command :(

My setting is following:

  1. Gradle version: 4.0
  2. Java 8
  3. Linux Debian
  4. settings.gradle

    apply from: "$rootProject.projectDir/buildCacheSettings.gradle"

  5. buildCacheSettings.gradle

ext.isCiServer = System.getenv().containsKey('CI') buildCache { local { enabled = !isCiServer } remote(HttpBuildCache) { url = System.getProperty('cache.url', 'http://private-buildcache-server') credentials { username = '*' password = '' } push = isCiServer } }

Any idea where the issue?

echiphn commented 6 years ago

in the Gradle documentation, the buildCache is available as a function, see: https://docs.gradle.org/4.0/dsl/org.gradle.api.initialization.Settings.html#org.gradle.api.initialization.Settings:buildCache(org.gradle.api.Action)

eriwen commented 6 years ago

@echiphn __gradle-completion-init runs ./gradlew tasks under the hood, so I expect this is not specific to completion.

Does gradle tasks work on your project or do you get the same error?

echiphn commented 6 years ago

@eriwen gradle tasks works properly. As I said, all other tasks works properly. What I've found: if i use gradle wrapper, then everything is fine! I haven't installed gradle wrapper before and I've got this issue after I add buildcache settings. But now, I've installed gradle wrapper, and it seems that everything is fine. But that is only workaround. Because in gradle autocomplete, there is no requirement to use gradle wrapper