Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 872
Chris Snow Avatar asked Dec 24 '22 20:12

Chris Snow


2 Answers

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'
like image 69
lifeisfoo Avatar answered Jan 05 '23 23:01

lifeisfoo


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: ''
like image 38
Chris Snow Avatar answered Jan 06 '23 00:01

Chris Snow