Hi,
I am trying to add a classpath dependency in a custom plugin instead of
defining it in my build script like this.:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'commons-lang:commons-lang:2.5', <--- shows an example of a
JAR I want to move into the plugin
'somegroup:myplugin:0.1'
}
}
The classes of the dependency are being used by the plugin itself. What's
the best way to do this? I want to prevent plugin users having to define the
dependency. I tried to go with this in my plugin implementation:
project.buildscript.dependencies.add("classpath",
"commons-lang:commons-lang:2.5")
However, that throw this exception:
Caused by: org.gradle.api.InvalidUserDataException: You can't change a
configuration which is not in unresolved state!
at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.throwExceptionIfNotInUnresolvedState(DefaultConfiguration.java:430)
at
org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.addDependency(DefaultConfiguration.java:297)
at org.gradle.api.artifacts.Configuration$addDependency.call(Unknown
Source)
at
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.pushDependency(DefaultDependencyHandler.groovy:52)
at
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.this$2$pushDependency(DefaultDependencyHandler.groovy)
at
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler$this$2$pushDependency.callCurrent(Unknown
Source)
at
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.add(DefaultDependencyHandler.groovy:42)
There must be something I am missing. Any help would be highly appreciated.
Thanks,
Ben
--
View this message in context:
http://gradle.1045684.n5.nabble.com/Defining-buildscript-dependency-in-custom-plugin-tp3620230p3620230.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email