grails-core: 5.0.0.RC2: HSQLDB or H2 should not be part of built artifact, when not defined in build.gradle

I created a fresh Grails 4.0.8 application and tried to exclude h2 from the resulting build artifact. Is tried to simply remove the h2 dependency from build.gradle. But h2 is still somehow referenced and can be found in the .war file. Also I found that HSQLDB is included as well.

I remember from Grails 3.x applications that it should be to possible to exclude h2 by this, but this doesn’t seem to work anymore:

    compile "org.grails:grails-dependencies", {
        exclude group:'com.h2database', module:'h2'
    }

From ./gradlew dependencies it seems h2/hsqldb gets included from grails-plugin-datasource, so I tried it this way:

    compile "org.grails:grails-plugin-datasource", {
        exclude group:'com.h2database', module:'h2'
    }

This doesn’t work either. But even if it would work, I don’t think this is a reasonable default behavior, as no one really uses h2/hsqldb in production.

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. grails create-app mytest
  2. cd mytest
  3. remove “h2” from build.gradle
  4. ./gradlew assemble

Expected Behaviour

HSQLDB and h2 should not be included in the resulting artifact.

Actual Behaviour

Both HSQLDB and h2 are found.

$ unzip -t ./build/libs/mytest-0.1.war | grep h2
    testing: WEB-INF/lib/h2-1.4.199.jar   OK
$ unzip -t ./build/libs/mytest-0.1.war | grep hsqldb
    testing: WEB-INF/lib/hsqldb-1.8.1.1.jar   OK

Environment Information

  • Operating System: Windows 10
  • Grails Version: 4.0.8
  • JDK Version: 11

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 19 (18 by maintainers)

Most upvoted comments

@davidkron Update: The default Grails web profile pulls a newish asset-pipeline-grails version which seems to employ strange dependency configurations - attempting to solve that via a PR.

The rest-api Grails profile is unaffected by that as revealed during testing of #12391.