Skip to content

Resolving layouts outside of the /layouts directory fails when running as war #10371

@ColinHarrington

Description

@ColinHarrington

Using relative URLs to resolve layouts outside of the /layouts folder works when running via bootRun, run-app or the static Application runner. When running the war they are not being resolved. Note: This used to work in Grails 2.x. It appears to have to do with the caching mechanism built into Layout resolution. A layout of ../foo/bar should map to /foo/bar in the view directory. It is attempting to resolve /layouts/../foo/bar which doesn't work when WAR'd.

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. Reference a layout outside of the /layouts directory
  2. Run the application via bootRun, run-app or the static runner.
  3. Note that the layouts are applied appropriately
  4. Build the war - ./gradlew assemble
  5. Run the war: java -jar myapp-0.1.jar from the build/libs directory

Expected Behaviour

The layout should be applied

Actual Behaviour

The layout is not resolved and is not applied

Environment Information

  • Operating System: Linux
  • Grails Version: 3.1.14
  • JDK Version: 1.8
  • Container Version (If Applicable): Tomcat/embedded

Example Application

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions