Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting httpPort for Jetty Grails plugin

Tags:

grails

jetty

I want to change the httpPort from the default of 8080 for the Jetty Grails plugin. I cannot set the Jetty httpPort property via a system property and/or Gradle property.

System property: gradle jettyRun -DjettyHttpPort=9090
Gradle property (gradle.properties): jettyHttpPort=9090

Right now you have to make a change to your Gradle build script (like adding a configuration task) to make this work. There are JettyPluginConventions with a function to setHttpPort(int) but I do not know how to implement it.

http://www.gradle.org/releases/1.0-milestone-3/docs/javadoc/org/gradle/api/plugins/jetty/JettyPluginConvention.html#setHttpPort(java.lang.Integer)

http://www.gradle.org/jetty_plugin.html

like image 468
Royer Avatar asked Jul 20 '11 19:07

Royer


2 Answers

I had the same problem, and documentation for Gradle is very general and vague. I sometimes think that only Gradle developers are able to get full potential of this great tool :)

Right now the way is to add following to gradle build script:

jettyRun {
    httpPort = 9000
}

It looks you cannot set this value in command line. There was an issue for that, GRADLE-1224, but it was closed as "Won't Fix" because

The Jetty plugin has been deprecated and is scheduled to be removed with Gradle 4.0. We are not going to work on this issue anymore.

like image 138
Tomek Cejner Avatar answered Sep 19 '22 20:09

Tomek Cejner


You can set properties like httpPort via JettyPluginConvention

convention.plugins.jetty.httpPort = 9090
like image 30
twester Avatar answered Sep 18 '22 20:09

twester