Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change the application name in Grails 3?

Tags:

gradle

grails

I'm a beginner using Gradle and Grails 3.x. In Grails 2.x appName could be changed in the application.properties file, now in Grails 3.0.8 the docs explain that it's possible in application.yml but I can't find a way to change appName.

like image 451
David de la Calle Avatar asked Oct 06 '15 17:10

David de la Calle


1 Answers

The application name is nearly irrelevant in Grails 3. It is used as the base name when you create a WAR file, but it's trivial to rename it before deploying, and you probably would regardless since it includes the application version.

It's used as the initial value of the grails.codegen.defaultPackage config setting, but you can change that easily:

grails:
   codegen:
      defaultPackage: 'com.foo.bar'

But I wouldn't bother with that since I don't use a default package - I specify the package for every artifact to avoid ending up with everything in one package.

In older versions of Grails it was used as the default context when running the app via run-app, e.g. http://localhost:8080/appname but in Grails 3 the default behavior of Spring Boot is used and there's no context by default. But if you want to specify the run-app context, you can do that (and optionally the port) with:

server:
   contextPath: /wheeeeeeee
   port: 9090

Gradle's default behavior is to use the directory name as its project name. If you want to override that, create a settings.gradle file and set the rootProject.name property:

rootProject.name = 'custom_app_name'
like image 194
Burt Beckwith Avatar answered Oct 20 '22 07:10

Burt Beckwith