Gradle Plugins Offline Resolution


(Zachary Richardson) #1

Hello, I am attempting to design a Gradle project with the following requirements:

  1. No internet access.
  2. No pre-existing Gradle cache
  3. A portable Maven repository containing all necessary plugins and dependencies.

I have been able to get external dependencies to resolve in an offline environment without a Gradle cache already, but plugin resolution fails and I haven’t found a solution despite multiple attempts.

As a simple example of what I’m shooting for, here is my build.gradle

plugins {
    id 'java'
    id "" version "0.8.6"
dependencies {
    compile "junit:junit:4.12"
repositories {
    maven {
        url "file://${project.projectDir}/mavenRepo"

And my settings.gradle:

pluginManagement {
    repositories {
        maven {
            url "file:mavenRepo"

The error I get is:

* Where:
Build file '/home/user/git/project/build.gradle' line: 6

* What went wrong:
Plugin [id: '', version: '0.8.6'] 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 '')
  Searched in the following repositories:
    Gradle Central Plugin Repository

There must be some step I’m missing here, or something I’ve got confused about dependencies and plugins. If anyone can offer help, I’d greatly appreciate it!

(James Justinic) #2

The plugins { ... } block method of applying plugins requires a way to map the plugin ID to the Maven coordinates of the artifact. It uses a POM file as a marker interface using the format ${pluginId}:${pluginId}.gradle.plugin:${pluginVersion}.

You likely have the artifact for, but not the marker interface which would be found at

(Zachary Richardson) #3

Thanks for the answer. That makes sense, where would the additional .pom file fit into the Maven repository’s structure? Would I manually put it alongside the .jar and .pom cached by Gradle’s initial download?

As of now, I’ve copied the cached files from ~/.gradle/caches/modules-2/files-2.1/ into what I believe is Maven’s correct format for my offline repository (mavenRepo in my above example). My current structure is below (which works for dependencies).
|_ protobuf-gradle-plugin
     |_ 0.8.6 
          |_ protobuf-gradle-plugin-0.8.6.jar
          |_ protobuf-gradle-plugin-0.8.6.pom 

(James Justinic) #4

If you take the URL to the POM posted above, and strip off the, thats the appropriate path in the Maven repository structure. Also, for the other dependencies, the standard Maven repository structure has the group separated by slashes (many folders) rather than one folder separated by dots.