[FOLIO-2548] Fix Maven ${} variable replacement in src/main/resources Created: 30/Mar/20 Updated: 03/Jun/20 |
|
| Status: | In Progress |
| Project: | FOLIO |
| Components: | None |
| Affects versions: | None |
| Fix versions: | None |
| Type: | Umbrella | Priority: | P3 |
| Reporter: | Julian Ladisch | Assignee: | Julian Ladisch |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | platform-backlog | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original estimate: | Not Specified | ||
| Issue links: |
|
||||||||||||||||||||
| Sprint: | CP: sprint 85 | ||||||||||||||||||||
| Story Points: | 4 | ||||||||||||||||||||
| Development Team: | Core: Platform | ||||||||||||||||||||
| Description |
|
Consider removing
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
from pom.xml for each RMB based back-end module (or use a more specific directory tree). This Maven filtering means that Maven replaces ${} variables in all files in all directories of the src/main/resources tree. If an RMB based module uses that section in pom.xml Maven will replace ${} variables in src/main/resources/templates/db_scripts at build time. This interferes with RMB's runtime replacement of ${} variables used in src/main/resources/templates/db_scripts/*.sql scripts of schema.json. Most notable example: Maven replaces ${version} with the current module version whereas RMB uses it for the previous module version the modules currently upgrades from. The ${version} variable is needed in upgrade scripts. Maven's wrong replacement is difficult to debug because Maven replaces the variable after the unit test phase. Use
grep -r '${'
to investigate where the Maven ${} variable replacement is needed. Modules that follow the https://github.com/folio-org/mod-rmb-template/blob/master/src/main/resources/archetype-resources/pom.xml use
<resources>
<resource>
<directory>${ramlfiles_path}</directory>
<filtering>true</filtering>
</resource>
</resources>
and
<resources>
<resource>
<directory>${basedir}/descriptors</directory>
<include>*Descriptor*-template.json</include>
<filtering>true</filtering>
</resource>
</resources>
and usually don't need to additionally add filtering for the complete src/main/resources tree. Try to reduce the filtering to those directory trees and files that actually need it. |