I am using the Maven assembly plugin to prepare some configuration artifacts for different environments, and I am using resource filtering to substitute parameter values.
I came across a weird behaviour where I had a property file with the contents as follows:
###########################
# author.name@company.com #
############################
env.name=${replacement.value}
The presence of the '@' symbol for the author's e-mail was causing all property references to be ignored.
I have tried looking for documentation as to why this happens - but cannot find anything that answers this behaviour. Any helpful pointers to documention or an explanation would be much appreciated.
For reference:
- Maven version: 2.2.1
- Maven Assembly Plugin version: 2.2
i had the same problem, i used a little workaround:
you must mantain '@' char always peer adding a fictitious variable
I had the same problem but I could not use Pascal's workaround as @s were part of filtered SQL scripts. So I elaborated on Pascal's solution and haven't found any way how to override default delimiters in Assembly Plugin. However, I've found another useful post (at the very bottom): http://web.archiveorange.com/archive/v/F1XzEmhzIHiBcpS0RyC6
Which suggests using a properly configured resource plugin to copy and filter problematic resources and then use these filtered resources in the assembly plugin. e.g.: (pom.xml)
(distribution.xml)
This is not documented in the filtering section of the Maven Assembly Plugin but it looks like it uses the same default delimiters as the Maven Resources Plugin which are:
So the following would be filtered as well:
And this also explains why a single
@
in the email address is causing troubles (the plugin never finds the end delimiter).It is possible to configure the delimiters and an escape string, just as it is when using the Maven Resources Plugin. The Maven Assembly Plugin documentation for the single goal provides the details.
A cheap workaround, for this particular email address situation, would be to avoid using a single
@
in the file to filter:And as a benefit, you'll avoid spam :)
You should specify the plugin explicitly in your pom.xml. Implicitly, it is using 2.4.1, which has this issue. You can verify which version maven is using by running maven -X resources:resources.
Version 2.6 fixed this problem.
Here the link to Maven JIRA issue: https://issues.apache.org/jira/browse/MRESOURCES-141
This seriously works. Define in a properties file as follows:
This should get negative points as it is crazy that it works.