jettyRun task cannot be configured, aborts with 'unknown property'
Attempting to configure the jettyRun or jettyRunWar tasks, e.g. adding additional dependencies, fails:
> Could not get unknown property 'jettyRun' for project ':frontend' of type org.gradle.api.Project.
Gretty is set up correctly as running the tasks without the additional dependency works fine. The gradle files look like this:
//root build.gradle
buildscript {
dependencies {
classpath 'org.akhikhl.gretty:gretty:1.4.1'
}
}
(snip)
//subproject build.gradle
apply plugin: 'org.akhikhl.gretty'
apply plugin: 'war'
gretty {
contextPath = '/whatever'
httpPort = 8090
}
task hello {
doLast {
print "hello"
}
}
//jettyRun.dependsOn hello //<-fails
//jettyRunWar.dependsOn hello //<-fails
(snip)
I am having this issue too. jettyRun.doFirst fails with Could not get unknown property 'jettyRun' for root project 'XXXYYY' of type org.gradle.api.Project
apply plugin: 'war'
apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'
repositories {
mavenCentral()
}
dependencies {
compile 'com.netflix.zuul:zuul-core:1.3.0'
}
war {
webXml = file('src/main/webapp/WEB-INF/web.xml')
}
gretty.contextPath = '/'
jettyRun.doFirst {
System.setProperty("zuul.filter.root", "src/main/groovy/filters")
}
This worked for me:
task hello {
doLast {
print "hello"
}
}
tasks.whenTaskAdded { task ->
if (task.name == 'jettyRun') {
task.dependsOn 'hello'
}
}
Tried ericranstrom's solution. Didn't work for me.
Editing the line in the source throwing the error did.
Changed line 56 of StartServer.java in zuul-simple-webapp: String scriptRoot = "src/main/groovy/filters"; //System.getProperty("zuul.filter.root", "");
ericranstrom's solution worked for me.