How do you change the application name in Grails 3?

前端 未结 1 453
挽巷
挽巷 2021-01-05 03:23

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 doc

相关标签:
1条回答
  • 2021-01-05 03:33

    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'
    
    0 讨论(0)
提交回复
热议问题