Florian Baierl
Florian Baierl

Reputation: 2491

Plugin was not found error during gradle build

When trying to add the org.ajoberstar.grgit plugin into my gradle build, I get the following error:

Plugin [id: 'org.ajoberstar.grgit', version: '2.3.0'] was not found in any of 
the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 
 'org.ajoberstar.grgit:org.ajoberstar.grgit.gradle.plugin:2.3.0')
  Searched in the following repositories:
    Gradle Central Plugin Repository

Here is my code:

import org.ajoberstar.grgit.*

buildscript {
    dependencies {
        classpath 'org.ajoberstar:grgit:2.3.0'
    }
}

plugins {
    id "org.sonarqube" version "2.6"
    id "idea"
    id "org.ajoberstar.grgit" version "2.3.0"
}

// ...

Any idea on how to solve this? Can I somehow manually download the plugin and put it into the cache?

Upvotes: 8

Views: 35674

Answers (3)

Greg
Greg

Reputation: 2627

Check the SSH handshake. In my case, I had to remove the following entries from my ~/.gradle/gradle.properties file, which was causing it to fail to connect securely to our corporate artifactory:

# systemProp.javax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts
# systemProp.javax.net.ssl.trustStorePassword=changeit

Upvotes: 1

Florian Baierl
Florian Baierl

Reputation: 2491

I am not entirely sure why, but it started working all of a sudden. Here is what I tried:

  • I had "C:/Program Files/..." in my JAVA_OPTS environment variable and replaced that with "C:/Programme/..." (German localization)
  • restarted my PC

After that it magically worked. I am pretty sure it has something to do with the companies proxies and some custom scripts for it (my best guess is that it didn't handle the space character in the JAVA_HOME variable well).

Upvotes: 1

Opal
Opal

Reputation: 84874

You need to either use:

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

or:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'org.ajoberstar:grgit:2.3.0'
    }
}

apply plugin: 'org.ajoberstar.grgit'

Upvotes: 9

Related Questions