[
https://issues.apache.org/jira/browse/MRESOURCES-284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17529087#comment-17529087
]
Imad BELMOUJAHID commented on MRESOURCES-284:
---------------------------------------------
No, it's impossible with normal properties files, to understand you see here, I
added this plugin in my own project, now I have only one JSON file and inside
you can see parameters for 4 different environments, the json file is very
readable with nice separation and formatting .
!11.png|width=608,height=258!
and in pom.xml I used the iterator-maven-plugin plugins to iterate on the 4
environments
!2.PNG|width=789,height=501!
!3.JPG|width=874,height=536!
we can't do the same thing with the classic property sheets, it's difficult.
Here is the result :
!5.JPG!
now if i need to change something for prod, preprod... environments i will
change it only on one file ( json file )
I won't make a mistake because I have only one file (JSON) to edit
This is the important benefit
I hope my idea is clear, and I hope the PR will be accepted so everyone can
benefit from it
> 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.7#820007)