For us to accomplish this nosotros volition postulate two maven plugins: org.codehaus.mojo:buildnumber-maven-plugin and com.google.code.maven-replacer-plugin:replacer.
And this is how to define these plugins inwards your country of war project.
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> <version>1.3</version> <executions> <execution> <phase>validate</phase> <goals> <goal>create</goal> </goals> </execution> </executions> <configuration> <doCheck>false</doCheck> <doUpdate>false</doUpdate> <shortRevisionLength>41</shortRevisionLength> </configuration> </plugin> This plugin, produces buildNumber variable, which tin flame live an id, engagement or a git construct no. We volition purpose the last.
With the next assumptions:
1.) The xhtml pages that nosotros desire to procedure for replacement are within template folder.
2.) We volition supersede two strings: VERSION_NUMBER too BUILD_NUMBER
<plugin> <groupId>com.google.code.maven-replacer-plugin</groupId> <artifactId>replacer</artifactId> <version>1.5.3</version> <executions> <execution> <phase>prepare-package</phase> <goals> <goal>replace</goal> </goals> </execution> </executions> <configuration> <includes> <include>${project.build.directory}/**/layout/*.xhtml</include> </includes> <replacements> <replacement> <token>@VERSION_NUMBER@</token> <value>${project.version}</value> </replacement> <replacement> <token>@BUILD_NUMBER@</token> <value>[${buildNumber}]</value> </replacement> </replacements> </configuration> </plugin>
0 komentar:
Please comment if there are any that need to be asked.