Selective regex replacement with the maven-replacer-plugin -
i'd use maven-replacer-plugin rename javascript import statements in index.html file.
however path starts app
index.html snippet
... <!-- rename 1 app/something12345.js --> <script src="app/something.js"></script> <!-- leave 1 --> <script src="vendor/angular.js"></script> ...
in pom.xml far have configuration maven-replacer-plugin
<plugin> <groupid>com.google.code.maven-replacer-plugin</groupid> <artifactid>replacer</artifactid> <version>1.5.2</version> <executions> <execution> <phase>prepare-package</phase> <goals> <goal>replace</goal> </goals> </execution> </executions> <configuration> <file>target/${project.build.finalname}/index.html</file> <replacements> <replacement> <token>(\.js")</token> <value>12345.js"</value> </replacement> </replacements> </configuration> </plugin>
at moment replace .js
matches.
is there magic incantation can put in <token>
section achieve this?
i managed using following
<replacement> <token>((app/)(.)*)(\.js")</token> <value>$112345.js</value> </replacement>
although in real application replaced 12345
${buildnumber}
variable, syntax was
<replacement> <token>((app/)(.)*)(\.js")</token> <value>$1${buildnumber}.js</value> </replacement>
which hope might make solution bit more understandable
Comments
Post a Comment