[ 
https://issues.apache.org/jira/browse/MRESOURCES-162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16305772#comment-16305772
 ] 

Michael Van Aken edited comment on MRESOURCES-162 at 12/28/17 10:04 PM:
------------------------------------------------------------------------

Here's what we're using until this is improved (not proud of this):

https://gist.github.com/anonymous/5fe2a01e5673e92beb8bd05d5b96cf7e#file-maven-filtering-enforcement-L57

It's based on Tunaki's very helpful answer to this

https://stackoverflow.com/questions/40216611/custom-mavenresourcesfiltering-hard-to-implement

Gist:

Basically...
# override the default FileFilter so that we can access fields in its private 
Wrapper (wouldn't be necessary with more plugability maybe)
# set the wrapper value source to one that reports when it's asked for a value 
it can't find (via a set of strings)
# after mapping the file, add any missed values to a threadlocal (probably not 
necessary but whatevs)
# override the DefaultResourceFiltering so we can clear threadlocal / harvest 
the file/missed-value-set mappings
# throw an exception with a really long message including all the values it 
couldn't find


When you look in the code, it's clear why this hasn't been done already...  
it's not as easy as it seems =[



was (Author: tehaxer):
Here's what we're using until this is improved:

https://gist.github.com/anonymous/5fe2a01e5673e92beb8bd05d5b96cf7e#file-maven-filtering-enforcement-L57

It's based on Tunaki's very helpful answer to this

https://stackoverflow.com/questions/40216611/custom-mavenresourcesfiltering-hard-to-implement

Gist:

Basically...
# override the default FileFilter so that we can access fields in its private 
Wrapper (wouldn't be necessary with more plugability maybe)
# set the wrapper value source to one that reports when it's asked for a value 
it can't find (via a set of strings)
# after mapping the file, add any missed values to a threadlocal (probably not 
necessary but whatevs)
# override the DefaultResourceFiltering so we can clear threadlocal / harvest 
the file/missed-value-set mappings
# throw an exception with a really long message including all the values it 
couldn't find


When you look in the code, it's clear why this hasn't been done already...  
it's not as easy as it seems =[


> Fail build if resource not fully filtered 
> ------------------------------------------
>
>                 Key: MRESOURCES-162
>                 URL: https://issues.apache.org/jira/browse/MRESOURCES-162
>             Project: Maven Resources Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.5
>            Reporter: Alexey Markevich
>            Priority: Minor
>             Fix For: backlog
>
>
> Scenario: project with some kind resource affected to the project properties. 
> If some property renamed then resource will contains placeholder instead of 
> actual value. It will be great to have configuration option like 'Fails if 
> property missing'.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to