Maven is used to build an application in the past two days. Due to the large project, there are more than 700 pom S. xml file, even more depressing is in many pom. the url of the resource library is specified separately in the xml file. I need to uniformly specify the URLs of these resource libraries to the local central nexus library.
Manually changing the file configuration is a bit impractical, So google, find a good way to replace the file content in batches, the command structure is as follows:
Find-name 'file name to be searched' | xargs perl-pi-e's | replaced string | G'
In the following example, the "example.
Find-name 'pom. xml' | xargs perl-pi-e's | http://repo1.maven.org/maven2 | http: // localhost: 8081/nexus/content/groups/public | G'
The Perl language is used here,
Perl-pi-e
Add the-e option to the Perl Command, followed by a line of code, and then it will run the code like running a common Perl script.
Using Perl from the command line can help implement some powerful and real-time conversions. Studying Regular Expressions carefully and using them correctly will save you a lot of manual editing work.