How to use the gradle shdow plugin offline?

491 Views Asked by At

I want to compile a vertx project with gradle. I want to compile it into a standalone jar, and I read this can be accomplished with gradle's shadow plugin.

Now, I need to be able to do this in an offline environment. I downloaded the plugin's source code and compiled it into a jar. Now, I want to apply the plugin from that jar in my project's build.gradle. I can't figure out how to do this.

I'm aware of these answers, but both don't seem to work.

Currently, I have:

buildscript {
    dependencies {
        classpath fileTree(dir: "/absolute/path/to/dir", include: "shadow-1.2.3.jar")
    }
}

plugins {
    id 'java'
    id 'application'
}

/* boring stuff */

shadowJar {
    classifier = 'fat'
    mergeServiceFiles {
        include 'MET-INF/services/io.vertx.core.api.VerticleFactory'
    }
}

When I run "gradle build", I get a "Could not find method shadowJar()" error.

1

There are 1 best solutions below

0
On

Solved by applying the plugin by class name:

apply plugin: com.github.jengelman.gradle.plugins.shadow.ShadowPlugin