How to set default port for grails application

01 / Feb / 2011 by Uday Pratap Singh 4 comments

As we all know the default port for grails application is 8080, though we can change the port by running the application by following command
[java]
grails -Dserver.port=7070 run-app
[/java]

What if you want the application to run on 7070 by default. Grails provide a very easy way to that as well. You just need to write the following lines in you buildConfig.groovy file
[java]
grails.server.port.http=7070
[/java]

And you are done. Now your application will run on 7070 by default, you dont need to provide the port again and again.

Hope it helps
Uday Pratap Singh
uday@intelligrape.com

FOUND THIS USEFUL? SHARE IT

comments (4)

  1. Uday Pratap Singh

    Hi Lalit
    Are you trying to say that we should change the port in grails script? I dont think it would be advisable to change the grails default configuration because this will become the default port for all other applications using same GRAILS_HOME.
    I dont find it to be a good practice to change the grails code.

    Reply
  2. Lalit

    You can check the below link for port settings in latest GRAILS distribution

    lalitagarw.blogspot.com/2011/06/grails-configuration-port-settings.html

    Reply

Leave a Reply to Uday Pratap Singh Cancel reply

Your email address will not be published. Required fields are marked *