Tip Details Add a Related Tip

Rate as: Positive Negative

Changing the port of a Grails project

When you load and start a Grails application, it uses the port 8080 by default. If you want to change the port being used by Grails, you have three ways you can do this. In all of these examples, I'm changing the port to be 9000.

1: Run-time change
==================
You can change the port used when you start the application by using the the -Dserver.port flag. Instead of running your application like this:

grails run-app

you run it like this:

grails -Dserver.port=9000 run-app

2: Permanent change for project
===============================
You can change the port for your project so that every time you run the project, it runs on a new port without having to add command line arguments.

To do this, go to the root directory for your project and then change into the grails-app/conf directory. Create a new file called BuildConfig.groovy (or edit the existing file if there is already one there) and add this line to the file:

grails.server.port.http = 9000

The nice thing about this approach is that if you have multiple grails projects you are working on, you can assign them all to a different port and have them running at the same time.

3: Permanent change to the default
==================================

To change the default so that projects always use the 9000 port instead of 8080, go into the .grails directory in your home directory. This is your home directory on your computer, not the grails or grails project home directory. Also note that this directory gets created once you run a grails application. If the directory does not exist, run your grails application and it will get created.

In the .grails directory, create a file called settings.groovy (or edit the existing file if there is one there already) and add the following line:

grails.server.port.http = 9000

With this line added, it will change the default port used by all grails projects on your machine that make use of the default port.
Rating: 100% positive, 1 Vote
Categories: Grails Groovy Java web development configuration
Added: on Nov 04, 2009 at 7:09 am
Added By: an anonymous user
Searches: grail port project directory run

Comments on this Tip

Add a Comment
There are no comments for this tip
Your Comment:
(how to format)
Rate This Tip:

Verify Humanity:
Sorry, we know it's annoying, but please enter the characters shown in the image to the left so that we know you're an actual person and not an evil spammer. Thanks.
       

Related Tips

Turn off LED Bluetooth notification on the Blackberry Storm

100% positive, 0 comments
– Tip added by an anonymous user on Jan 05, 2009 at 7:14 pm

Blackberry Pearl prevent data roaming

100% positive, 0 comments
– Tip added by an anonymous user on Jan 12, 2009 at 11:41 am

How to promote a business using social media marketing?

100% positive, 1 comment - last added on May 27, 2009 at 7:31 am
– Tip added by an anonymous user on May 27, 2009 at 1:21 am

Customize Thunderbird email folders

100% positive, 0 comments
– Tip added by an anonymous user on Oct 23, 2009 at 7:14 am

Gestures to switch between tabs in Firefox

100% positive, 1 comment - last added on Jul 28, 2009 at 9:55 am
– Tip added by an anonymous user on Jul 09, 2009 at 1:02 pm

22 Really Web Safe Colors

100% positive, 0 comments
– Tip added by codenique.com on Apr 20, 2009 at 12:16 pm

Web Color Basics

100% positive, 0 comments
– Tip added by codenique.com on Apr 15, 2009 at 6:14 am

CSS3 Color Names

100% positive, 0 comments
– Tip added by codenique.com on Apr 14, 2009 at 4:18 am

Easier Firefox configuration

100% positive, 0 comments
– Tip added by an anonymous user on Jan 28, 2009 at 10:47 am

PHP strftime errors in Smarty

no ratings, 0 comments
– Tip added by an anonymous user on Nov 03, 2009 at 3:04 pm

Keep screen from dimming when watching videos on a Blackberry

no ratings, 0 comments
– Tip added by an anonymous user on Oct 16, 2009 at 12:12 pm

Organizing your iPhone applications on home screen

Categories: iPhone configuration
no ratings, 0 comments
– Tip added by an anonymous user on Sep 21, 2009 at 4:38 pm

Hide PHP server information

Categories: PHP server configuration
no ratings, 0 comments
– Tip added by an anonymous user on Aug 31, 2009 at 10:34 am

Turn off data roaming on the Blackberry Tour

no ratings, 0 comments
– Tip added by an anonymous user on Aug 16, 2009 at 8:18 am

what is the benefit of get a quote

no ratings, 0 comments
– Tip added by an anonymous user on Jul 13, 2009 at 5:57 am

Disable Location Aware Browsing in Firefox

no ratings, 0 comments
– Tip added by an anonymous user on Jul 09, 2009 at 9:33 am

Comprehensive Manual for Moodle Administrator

no ratings, 0 comments
– Tip added by anusonia on May 18, 2009 at 2:14 am

Have iTunes 8 automatically import inserted CDs

no ratings, 0 comments
– Tip added by an anonymous user on Jan 19, 2009 at 9:41 am

Printing from notepad

no ratings, 0 comments
– Tip added by an anonymous user on Jan 08, 2009 at 8:20 am