开发者

Setting httpPort for Jetty Grails plugin

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.gra开发者_运维技巧dle.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


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.


You can set properties like httpPort via JettyPluginConvention

convention.plugins.jetty.httpPort = 9090


You can start with below command

gradle jettyRun -DhttpPort=9000

However, the task jettyRunWar doesn't seem to pick port 9000 and still uses default port. May be a bug in gradle jetty plug-in.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜