Accueil / Java Techs / Grails / How to change default server port for Grails application
An Grails application started successfully
An Grails application started successfully

How to change default server port for Grails application

Print Friendly, PDF & Email

As a web developer, all of us are aware of the number 8080 as the holy port nobody can forget. In Grails based applications, there is no exception at all.

For some reasons, we might need to run multiple grails application on our laptop. In this situation, knowing how to change the default port of grails application would be valuable.

In this post, I will show you how to obtain the purpose by doing few steps below.

Prior to grails 3.x, we can change the port by running the application using following command:

grails -Dserver.port=8181 run-app

This command sets the given port temporarily. You have to use this command each time when you run the application from the terminal or console.
If you want to change port permanently, i.e., the application by default runs on other port than 8080, you can easily fix the port number by adding following line in your BuildConfig.groovy file:


A few years ago, grails 3.x was released and they have changed the way of changing the default port. This is right to grails 4.x though there are lots of changed and improved.

For Temporary change
Run the application using following command from the terminal where the project locates:

SERVER_PORT=8181 grails run-app

For Permanent change
Add following line in your application.yml file


Or, add the following line in your application.groovy file

Hopefully, these tricks would bring a convenient way for you to change the server port of your Grails applications.

All constructive comments are welcomed. If you are willing to contribute financial support for our website, please follow the instructions below.

À propos Nguyen Vu Ngoc Tung

I love making new professional acquaintances. Don't hesitate to contact me via if you want to talk about information technology, education, and research on complex networks analysis (i.e., metabolic networks analysis), data analysis, and applications of graph theory. Specialties: researching and proposing innovative business approaches to organizations, evaluating and consulting about usability engineering, training and employee development, web technologies, software architecture.

Un commentaire

Laisser une réponse

Votre adresse email ne sera pas publiéeLes champs requis sont surlignés *




Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.