How to use jetty plugin properties?


(Maciek Opała) #1

Hi, How to use jetty plugin properties? The following piece of code:

[jettyRun, jettyRunWar, jettyStop]*.with {

httpPort = 8887

stopPort = 8081

stopKey = ‘stopKey’

jettyEnvXml = file(‘src/test/resources/jetty-env.xml’) }

generates warning message:

Dynamic properties are deprecated: http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html Deprecated dynamic property: “httpPort” on “task ‘:client:jettyStop’”, value: “8887”. Deprecated dynamic property: “jettyEnvXml” on “task ‘:server:jettyRunWar’”, value: “/yyy/workspace/d…”. Deprecated dynamic property “httpPort” created in multiple locations. Deprecated dynamic property: “jettyEnvXml” on “task ‘:server:jettyStop’”, value: “/yyy/workspace/d…”.


(René Groeschke) #2

Hello Opal, The jetty plugin ships with three convention properties, that can be directly configured in the buildscript:

httpPort = 8887
 stopPort = 8081
 stopKey = 'stopKey'

The jettyEnvXml property is only available for the jettyRun task. to configure the jettyRun task to use your jetty-env.xml file you can do:

jettyRun{
     jettyEnvXml = file('src/test/resources/jetty-env.xml')
}

Gradle allows the creation of dynamic properties. If a property does not yet exist, it will be created. An example:

In your example snippet you try to set the httpPort on the jettyStop task. As the httpPort property does not exist for the jettyStop task (see dsl reference at http://gradle.org/docs/current/dsl/org.gradle.api.plugins.jetty.JettyStop.html) groovy dynamically creates this object. As we changed this default behaviour to avoid accidently created properties, the deprecation warning is written.

regards, René


(Maciek Opała) #3

Thanks for exhaustive and useful response.