Gradle new plugin installation


(Roman H) #1

What should I do to install a plugin into gradle so I can use it in the future builds.

I want to use rpm plugin here: https://github.com/TrigonicSolutions/gradle-rpm-plugin

I tried downloading the project and copying the jar that’s there in the %GRADLE_HOME%/lib/plugins, but it doesn’t look like it works since

apply plugin: ‘rpm’

fails.

This should probably be easy, but I don’t see it in docs or can’t really find how to do it. Do I need to run some task to put the jar in the repository of plugins? Any info would be appreciated.


(Peter Niederwieser) #2

Just follow the link you posted and check the README of the plugin.


(Roman H) #3

Do you mean README.md? It contains information how to use it, but I don’t see anything about how to install it.

It might me a stupid question, but I couldn’t find how do I install plugins to gradle.


(Peter Niederwieser) #4

There is no separate installation step. You just need to declare a buildscript dependency on the plugin, as shown under “Usage” in the README.


(Roman H) #5

But how does it get the rpm plugin? I operate from linux box that is not connected to internet, so I guess I need to copy it somewhere in repository of plugins.


(Peter Niederwieser) #6

In that case, you need to download the plugin Jar and change the declaration to:

buildscript {
    dependencies {
        classpath files("absolute/or/relative/path/to/plugin/jar")
    }
}

(Peter Niederwieser) #7

If the plugin has third-party dependencies, you need to download and declare them as well. Or you install an in-house repository manager that proxies Maven Central.


(Roman H) #8

Thanks, that makes it more clear. I guess I will install in-house repository.


(Peter Niederwieser) #9

I recommend to give Artifactory a try.


(Roman H) #10

Ok, I talked to people in the office and it turns out that someone already installed Artifactory, lucky me.

So, I uploaded the jar there, I took the jar from maven repository here: http://search.maven.org/#browse|-1760209988

I downloaded the jar and uploaded it locally.

Artifactory says to use this line (the path is Repository Path: plugins-release-local:gradle-rpm-plugin/gradle-rpm-plugin/1.4/gradle-rpm-plugin-1.4.jar ):

compile(group: ‘gradle-rpm-plugin’, name: ‘gradle-rpm-plugin’, version: ‘1.4’)

I inserted it in dependencies.

As for repository I have this:

repositories {

maven {

url “http://ourcompany.com/artifactory/plugins-release-local

} }

I also have

apply plugin: ‘rpm’

line in the build script. I still get the error that plugin with id ‘rpm’ is not found, so I guess something in my configuration is not right.


(Peter Niederwieser) #11

You also need to upload the POM. Then follow the instructions in the README. (Your code above differs from what’s written in the README.)