how to set a grails 3 app to use a root context path?

最后都变了- 提交于 2019-12-12 15:28:35

问题


I'm trying to set a root context path for my application in `conf/application.yml' like so:

server:
    'context-path': '/'

However, when trying to start grails> run-app, I get the following exception:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootRun'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

回答1:


From Grails 3.0.3, the expected configuration key is contextPath, camel case and not hyphenated. So the right setting in your application.yml is:

server:
    contextPath: '/my-path'

Or, if you're using application.groovy:

server.contextPath='/my-path'



回答2:


I should have paid more attention to the error log output from run-app. The correct setting is:

server:
    'context-path': ''

>= Grails 3.0.3:

server:
    contextPath: ''


来源:https://stackoverflow.com/questions/29721715/how-to-set-a-grails-3-app-to-use-a-root-context-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!