1

I' having issues while trying to change the port for Gretty as indicated in the Gretty documentation.

Gradle appRunWar -PhttpPort=8888 

The only way it works is by changing the build.gradle gretty block

gretty {
    http = 8888
    contextPath = '/'
}
lac_dev
  • 1,336
  • 14
  • 20

1 Answers1

1

I found the solution after searching the Gretty Possible Running Build in Different Ports Github repository.

All you need to do is change the build.gradle file as follows

gretty {
    httpPort = project.hasProperty("httpPort") ? project.httpPort as int : 8080
    contextPath = '/'
}

Another way to do this is by adding the following

gradle.taskGraph.whenReady {
    graph ->
        if (project.hasProperty("httpPort")) {
            gretty.httpPort = httpPort as int
        }
}

Both solutions will work by passing property arguments to the guild file

 gradle -PhttpPort=8888 
lac_dev
  • 1,336
  • 14
  • 20