We are using the embedded tomcat plugin and have decided to externalize the configuration for easy re-use.
I extracted everything out to embedded.gradle that used to live in our build.gradle.
apply plugin: 'tomcat'
buildscript{
buildscript.repositories {
add(new org.apache.ivy.plugins.resolver.URLResolver()) {
name = 'GitHub-4-tomcat'
addArtifactPattern 'http://cloud.github.com/downloads/[organisation]/[module]/[module]-[revision].[ext]'
}
}
dependencies {
classpath 'bmuschko:gradle-tomcat-plugin:0.8.2'
}
}
dependencies {
def tomcatVersion = '7.0.11'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}",
"org.apache.tomcat:tomcat-dbcp:${tomcatVersion}"
tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
}
}
[
tomcatRun,
tomcatRunWar,
tomcatStop
]*.with{
configFile = file("src/test/resources/tomcat-context.xml")
httpPort = tomcatStartPort as int
stopPort = tomcatStopPort as int
stopKey = "ctl-d"
}
//-- test hooks to run/stop tomcat around test execution
task integrationTest(type: Test) {
include '**/*IntegrationTest.*'
doFirst {
tomcatRun.daemon = true
tomcatRun.execute()
}
doLast { tomcatStop.execute() }
}
Now I just include it in our build.gradle:
apply from: './tomcat-embedded.gradle'
And it fails with the following trace.
* What went wrong: A problem occurred evaluating script. > Plugin with id 'tomcat' not found.
Any ideas?