Paul Wellner Bou
Paul Wellner Bou

Reputation: 554

redirect() does not resolve @info.app.name@ in Grails when started with gradle bootRun

I just upgraded a Grails 2 project to Grails 3 and I have some problems resolving @info.app.name@ running with ./gradlew bootRun. In my application.yml I have this:

info:
    app:
        name: '@info.app.name@'
        version: '@info.app.version@'
        grailsVersion: '@info.app.grailsVersion@'

In my Controller I have:

def index = {
    redirect(action: 'invoices')
}

Running the application in Tomcat, this works fine and /profakt/invoiceSheet/index is redirected correctly to /profakt/invoiceSheet/invoices.

Running the application with ./gradlew bootRun the application name is not resolved correctly and the redirect is trying to redirect to /@info.app.name@/invoiceSheet/invoices.

I noticed that, if I remove this line from my build.gradle, it works again:

bootRun {
    systemProperties = System.properties
}

But I would really like to keep this line, to be able to configure some (db) urls with environment variables.

Any idea how I use System.properties with bootRun?

Upvotes: 0

Views: 294

Answers (1)

Stephen Joyner
Stephen Joyner

Reputation: 26

Try:

bootRun {
    systemProperties(System.properties)
}

This should append the properties instead of reset them.

Upvotes: 1

Related Questions