I wrote a custom plugin and placed that jar under $gradleHome/lib/plugins. It used to work Under Gradle1.0-milestone-3 but under Gradle1.0-milestone-4 it throws java.lang.ClassNotFoundException because of the following reasons mentioned in the below link -
If build script path can load custom plugin jar from $gradleHome/lib or $gradleHome/lib/plugins then the developer has to just give the following line -
apply plugin: 'pg'
I can put my custom jar under $gradleHome/lib or $gradleHome/lib/plugins and could create custom Gradle installer for my organization.
Is there any clean solution where each and every team / developer do not have to add that few lines of glue code for loading custom plugin in build scripts?
Use with caution though because it does make your build less portable because you are now relying on something external (just like putting jars in ‘$GRADLE_HOME/lib’).
apply plugin: 'pg' //plugin defined in pgplugin.jar
version = "36.0"
thirdPartyDependencies {
compile id: 'log4j'
compile id: 'springframework.core'
testCompile id: 'junit'
}
after I run “gradle --stacktrace --init-script init.gradle clean”
I get the following error -
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:408)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.addDependency(DefaultConfiguration.java:293)
So how do I download my custom plugin from binary repository from init script?