[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:
Blocks
is blocked by MODCONF-51 Fix Maven ${} variable replacement in... Closed
is blocked by MODNOTES-140 Fix Maven ${} variable replacement in... Closed
Relates
relates to RMB-588 investigate wrong value passed from "... Closed
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.


Generated at Thu Feb 08 23:21:27 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.