如何设置 grails 3 应用程序以使用根上下文路径?
how to set a grails 3 app to use a root context path?
我正尝试在“conf/application.yml”中为我的应用程序设置根上下文路径,如下所示:
server:
'context-path': '/'
但是,当尝试启动 grails> run-app
时,出现以下异常:
失败:构建失败,出现异常。
* 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
我应该多注意 run-app
输出的错误日志。正确的设置是:
server:
'context-path': ''
>= Grails 3.0.3:
server:
contextPath: ''
从 Grails 3.0.3 开始,expected configuration key is contextPath
驼峰式大小写且未连字符。所以 application.yml
中的正确设置是:
server:
contextPath: '/my-path'
或者,如果您使用 application.groovy
:
server.contextPath='/my-path'
我正尝试在“conf/application.yml”中为我的应用程序设置根上下文路径,如下所示:
server:
'context-path': '/'
但是,当尝试启动 grails> run-app
时,出现以下异常:
失败:构建失败,出现异常。
* 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
我应该多注意 run-app
输出的错误日志。正确的设置是:
server:
'context-path': ''
>= Grails 3.0.3:
server:
contextPath: ''
从 Grails 3.0.3 开始,expected configuration key is contextPath
驼峰式大小写且未连字符。所以 application.yml
中的正确设置是:
server:
contextPath: '/my-path'
或者,如果您使用 application.groovy
:
server.contextPath='/my-path'