Adding plugin to gradle default classpath


(Ricardo Mayerhofer) #1

Hi all,

Is there a way to add a given plugin to gradle default classpath? Currently my aproach consists of copying the plugin jar to a folder and reference that folder in the build script.

e.g.

apply plugin: DeployPlugin

buildscript {

dependencies {

classpath fileTree(dir: ‘lib’, include: ‘*.jar’)

}

}

I’m looking for a aproach where there is no need to reference the jar in the build script. I’ve tried to copy it to GRADLE_HOME/lib or GRADLE_HOME/lib/plugins, but it didn’t work :frowning:

Thx.


(Peter Niederwieser) #2

You could put the (slightly modified) ‘buildscript’ block into ‘~/.gradle/init.gradle’, or into ‘init.d/init.gradle’ inside your Gradle distribution.


(Ricardo Mayerhofer) #3

Hi, Thanks for your response. I’ve tried to create a loadPlugin.gradle and moved it to init.d. I’ve got the following error:

A problem occurred evaluating initialization script. You can’t change a configuration which is not in unresolved state!

Here goes the script body: buildscript {

dependencies {

classpath fileTree(dir: “/opt/gradle-1.3/lib/custom-plugins”, include: “*.jar”)

} }

I’m using gradle 1.3.

Any idea?


(Peter Niederwieser) #4

Someone is trying to configure a configuration after it has been resolved, which isn’t allowed. Typically this happens when a configuration is resolved too early, such as someone iterating over the resolved files in the configuration phase, rather than the execution phase. The full error message should give some more hints.