Technipelago AB

Technipelago Blog Stuff that we learned...


Micronaut module name changes between RC2 and RC3

Publicerad den 15 okt 2018 av Göran Ehrsson

Once again Perl came to my rescue!

Many years ago I used Perl to batch update Grails source code.

When Micronaut changed module names between RC2 and RC3 I took the old Perl script from my blog and changed it to add micronaut- in front of all dependencies in build.gradle. I only had 15 build.gradle files to change so I could probably have done it manually, but there's many io.micronaut dependencies in each build file so a script is more convenient and eliminate the risk of typos.

In Micronaut RC2 and earlier a io.micronaut dependency could look like this:

compile "io.micronaut:inject"

In RC3 all module names was prefixed with micronaut- 

compile "io.micronaut:micronaut-inject"

Here is the Perl script that change all io.micronaut:..... lines for you:

update-micronaut-module.pl 

while(<>) {
  if(/(io\.micronaut[^:]*):(.+)/) {
    print "$`$1:micronaut-$2$'";
  } else {
    print $_;
  }
}

Make sure you checked in all build.gradle files to your VCS before continuing.

perl -i update-micronaut-module.pl */build.gradle

-i performs inplace editing, i.e overwrites the file after completion

 

WARNING: Don't runt the script twice, as it will add the micronaut- prefix each time you run it.

 

Tags: micronaut perl


« Tillbaka