apache / apache/grails-core

Unable to override ValidationTagLib in Grails 3.1.12

Open
#10,311 8 comments 1 reaction 0 assignees View on GitHub
info: workaround available
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

I'm trying to override the default `g:message` taglib to implement custom behaviour by creating a custom taglib that extends ValidationTagLib.

I see the following info message in server startup logs and the `g:message` from `ValidationTagLib` is being called instead of from my taglib.

`org.grails.core.artefact.TagLibArtefactHandler` - There are conflicting tags: `com.xms.taglib.XgMessageTagLib.g:message` vs. `org.grails.plugins.web.taglib.ValidationTagLib.g:message`. The former will take precedence.

The same implementation worked in grails 2.2.3. Is there any way to override taglibs in grails 3.1.12

I'm doing it like this.
```
class XgMessageTagLib extends ValidationTagLib
{
Closure message = { attrs ->
.......................
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with XgMessageTagLib and the inherited ValidationTagLib.g:message implementation in Grails 3.1.12. Read the TagLibArtefactHandler startup conflict message and compare the taglib override behavior with Grails 2.2.3. Done means a custom g:message implementation is selected without the reported conflict preventing the intended behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.