Configure httpPort for the Jetty Grails Plugin

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

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

Now you have to make changes to your Gradle build script (for example, add a customization task) to make this work. There is a JettyPluginConventions with the setHttpPort (int) function, but I don't 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

+7
source share
4 answers

I had the same problem and the documentation for Gradle is very general and vague. I sometimes think that only Gradle developers can get the full potential of this wonderful tool :)

Currently, the path is this: Gradle build script:

 jettyRun { httpPort = 9000 } 

It looks like you cannot set this value on the command line. There was a problem for this, GRADLE-1224 , but it was closed as "It will not be fixed," because

The Jetty plugin is deprecated and is planned to be removed using Gradle 4.0. We will no longer work on this issue.

+16
source

You can set properties like httpPort via JettyPluginConvention

 convention.plugins.jetty.httpPort = 9090 
+1
source

You can start with the command below

 gradle jettyRun -DhttpPort=9000 

However, the jettyRunWar task does not display port 9000 and still uses the default port. May be a bug in the gradle plugin.

0
source

Have you tried -Djetty.port = 9090 as a JVM parameter?

-one
source

All Articles