Alex028502
Alex028502

Reputation: 3814

pass in gretty options on the command line

Does anybody know if there is an easy way to override the gretty, or any gradle configuration on the command line?

(the ones here: http://akhikhl.github.io/gretty-doc/Gretty-configuration.html)

I have tried this

gradle -Dgretty.httpPort=8111 :web:jettyRun

but it still runs on port 8080.

Upvotes: 3

Views: 343

Answers (1)

miskender
miskender

Reputation: 7938

You can configure it like below,

gretty {
   if(project.hasProperty('portNumber')){ // if variable passed use it
       httpPort=Integer.parseInt(portNumber)
   }
   else{ // if it is not passed use a default port
      httpPort=8080
   }
...
}

And when you want to use a specific port gradle ... -PportNumber=8111

Upvotes: 2

Related Questions