How to change grails localhost port?

There are two options:

  1. Change grails.serverURL in Config.groovy from "http://localhost:8080/${appName}" to "http://localhost:8090/${appName}".
  2. Launch grails with -Dgrails.server.port.http=8090 on the command line. Set the GRAILS_OPTS environment variable to -Dgrails.server.port.http=8090 to have it applied automatically.

For grails 3 you can put this in your application.yml

server:
    port: 9999

If you are using Netbeans IDE then set the following -:

Config: -> BuildConfig.groovy: -> grails.server.port.http = 8090 and restart the server.

Without IDE, type in the command prompt -:

grails -Dserver.port 8090 run-app

or

grails -Dserver.port=8090 run-app

This solution adds to the answers http://stackoverflow.com/a/10956283/122457. In Grails 2.x, add the following to BuildConfig.groovy:

grails.server.port.http = 8090

See http://forum.springsource.org/archive/index.php/t-97024.html for further details.

Tags:

Grails