[
https://issues.apache.org/jira/browse/MRESOURCES-284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17820829#comment-17820829
]
ASF GitHub Bot commented on MRESOURCES-284:
-------------------------------------------
gnodet closed pull request #31: [MRESOURCES-284] Support JSON format for
parameter filter files
URL: https://github.com/apache/maven-filtering/pull/31
> 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
> Priority: Major
> Labels: features, pull-request-available
> Attachments: 11.png, 2.PNG, 3.JPG, 5.JPG
>
> Original Estimate: 96h
> Remaining Estimate: 96h
>
> 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 json (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.10#820010)