You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Imad BELMOUJAHID (Jira)" <ji...@apache.org> on 2022/04/25 22:48:00 UTC
[jira] [Created] (MRESOURCES-284) Support JSON format for parameter filter files
Imad BELMOUJAHID created MRESOURCES-284:
-------------------------------------------
Summary: Support JSON format for parameter filter files
Key: MRESOURCES-284
URL: https://issues.apache.org/jira/browse/MRESOURCES-284
Project: Maven Resources Plugin
Issue Type: New Feature
Components: filtering
Affects Versions: 3.2.0
Reporter: Imad BELMOUJAHID
I wanted to trace a new evolution that I added recently. This concerns the maven-resources-plugin (3.2.1-SNAPSHOT) and maven-filtering (3.3.0-SNAPSHOT) plugins.
with this evolution it is now possible to add configuration files with json format. the second part of the evolution is to have to use a single configuration json file for all environments (dev, preprod, prod)
Example of use:
{code:java}
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>resources</goal>
</goals>
<configuration>
<rootNode>dev</rootNode>
<!--suppress UnresolvedMavenProperty -->
<delimiters>@_*_@</delimiters>
<filters>
<filter>${project.basedir}/src/main/properties/test.json</filter>
</filters>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin> {code}
<rootNode>dev</rootNode> : four determine the environment if the json file contains multiple environments. if you want to use multiple files jdon (one for each environment), you can remove this parameter and add the full path from the root node in the ressource file (application.yml).
Example test.json:
{code:java}
{
"dev" : {
"type" : "toto",
"key2" : "value2",
"key3" : {
"key4" : "value4"
}
},
"qualif" : {
"type2" : "toto1",
"key5" : "value7",
"key7" : {
"key8" : "value7"
}
}
} {code}
Example ressource file: application.yml
{code:java}
spring:
profiles: @_key3.key4_@
toto: @_type_@
tata: @_key2_@ {code}
Example result:
{code:java}
spring:
profiles: value4
toto: toto
tata: value2 {code}
I will send the PR
thanks
--
This message was sent by Atlassian Jira
(v8.20.7#820007)