Original issue: https://issues.gradle.org/browse/GRADLE-2136
Expected Behavior
An external plugin can be applied in a script plugin by ID. The plugin can be added to the build script's classpath and applied with the plugins DSL or the buildscript block.
Current Behavior
An external plugin can only be applied in a script plugin by type. If applied in a script plugin an exception is thrown saying that the plugin cannot be found.
* What went wrong:
A problem occurred evaluating script.
> Plugin with id 'com.bmuschko.tomcat' not found.
Context
This is an unnecessary limitation of Gradle's plugin system. Users run into the issue all the time. The limitation is not documented.
Steps to Reproduce (for bugs)
build.gradle:
apply from: 'script.gradle'
script.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.bmuschko:gradle-tomcat-plugin:2.2.5'
}
}
apply plugin: 'com.bmuschko.tomcat'
Another manifestation:
//build.gradle
buildscript {
repositories { ... }
dependencies {
classpath "org._10ne.gradle:rest-gradle-plugin:0.4.2" //any external plugin can be used
}
}
apply plugin: "org.tenne.rest"
task fromMain(type: org._10ne.gradle.rest.RestTask) { //works fine
//...
}
apply from: 'gradle/other.gradle'
//other.gradle
task fromOther(type: org._10ne.gradle.rest.RestTask) { //fails
//...
}
FAILURE: Build failed with an exception.
* Where:
Script '/tmp/plugin-class-other-script/gradle/other.gradle' line: 1
* What went wrong:
A problem occurred evaluating script.
> Could not get unknown property 'org' for root project 'plugin-class-other-script' of type org.gradle.api.Project.
Original issue: https://issues.gradle.org/browse/GRADLE-2136
Expected Behavior
An external plugin can be applied in a script plugin by ID. The plugin can be added to the build script's classpath and applied with the plugins DSL or the
buildscriptblock.Current Behavior
An external plugin can only be applied in a script plugin by type. If applied in a script plugin an exception is thrown saying that the plugin cannot be found.
Context
This is an unnecessary limitation of Gradle's plugin system. Users run into the issue all the time. The limitation is not documented.
Steps to Reproduce (for bugs)
build.gradle:
script.gradle:
Another manifestation: