Skip to content

Message sources from exploded plugins in multi-project setup are not loaded with Gradle 4+ #11099

@davidkron

Description

@davidkron

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)

Description

I have a multi-project setup with multiple grails plugins and a single main application. I wanted to upgrade to Gradle 4, but every message source placed in one of the plugins will not be loaded when starting the main application.

The main application loads the plugins like this:

grails {
    pathingJar = true
    exploded = true
    plugins {
        compile project(':plugin1')
        compile project(':pulgin2')
    }
}

Also hot reloading has to be enabled in gradle.properties (inside plugin):

exploded=true

Steps to Reproduce

  1. create multi-project gradle build with a grails plugin and a grails application
  2. add plugin as a dependency to application
  3. configure plugin for hot reloading (exploded=true in gradle.properties inside plugin)
  4. add custom entry in messages.properties inside plugin
  5. use the created message property inside application, e.g. in a GSP
  6. start application

Expected Behaviour

Since application has a dependency to the plugin, every message property should be available in the main application.

Actual Behaviour

Message source from plugin is not loaded. The behavior is likely due to the changes of the build output folder in Gradle 4 from build/classes/main to build/classes/groovy/main.

With some debugging I discovered the culprit to be the method findRootResourcesURL in the class grails.io.IOUtils, specifically this line:

rootPath = rootPath.replace('/build/classes/', '/build/resources/')

With the new output folder from Gradle, this will produce a path like */build/resources/groovy/main instead of */build/resources/main.

Environment Information

  • Operating System: Windows 10
  • Grails Version: 3.3.8
  • JDK Version: 8

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions