If you deploy this app via Dokku, you'll need to add some environment variables (via dokku config:set
)
GRADLE_TASK=assemble
- By default, the Gradle buildpack tries to execute a Gradle task called
stage
, and fails if it can't find it. - The Heroku documentation suggests adding this
stage
task, whereas the Grails documentation suggests executing the Gradle taskassemble
. - I tried the “Heroku way” first, but encountered serious issues (see below) which I could not solve, so I went the “Grails way”.
Therefore, we need to set the
GRADLE_TASK
environment variable.
- By default, the Gradle buildpack tries to execute a Gradle task called
GRADLE_OPTS=-Dfile.encoding=UTF-8
.properties
files withUTF-8
characters work in Java 9+, but we still need to tell Gradle that the files are encoding inUTF-8
(source).
JDBC_DATABASE_URL="jdbc:postgres://<host>:5432/<database>?user=<username>&password=<password>"
- Even though Dokku automatically sets the
DATABASE_URL
env variable, it's not in the right format (postgres://<username>:<password>@<host>:5432/<database>
).
- Even though Dokku automatically sets the
- If you get the error Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory() during the build, try removing the folder
/home/dokku/covers/cache/
.- Since I moved from Grails 3 / Gradle 3.5 to Grails 4 / Gradle 5, it's possible that the old files interfered with the new ones.
- In my case, it was not a permissions problem as described here, so setting
GRADLE_USER_HOME
was useless.