gretty icon indicating copy to clipboard operation
gretty copied to clipboard

jettyRun task cannot be configured, aborts with 'unknown property'

Open ghost opened this issue 8 years ago • 4 comments

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)

ghost avatar Feb 20 '17 11:02 ghost

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")
}

0x5d avatar Mar 14 '17 20:03 0x5d

This worked for me:

task hello {
    doLast {
        print "hello"
    }
}

tasks.whenTaskAdded { task ->
  if (task.name == 'jettyRun') {
    task.dependsOn 'hello'
  }
}

ericranstrom avatar Mar 18 '17 22:03 ericranstrom

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", "");

duncanscott avatar Aug 18 '17 23:08 duncanscott

ericranstrom's solution worked for me.

thegeett avatar Feb 13 '20 05:02 thegeett