I currently have a build.gradle
which looks like this:
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
it should look like this:
buildscript {
repositories {
google()
jcenter()
}
}
allprojects {
repositories {
google()
jcenter()
}
}
To be specific I need to replace
jcenter()
maven {
url "https://maven.google.com"
}
with
google()
jcenter()
I have to do this on the fly, f. ex. with sed
as the build.gradle is generated by cordova on the build. Some packages are not found in jcenter. That's why I have to change the order.
I was able to replace the first three lines:
sed -i '' -e 's#jcenter()#google()#g' build.gradle
sed -i '' -e 's#maven {#jcenter()#g' build.gradle
sed -i '' -e 's#url "https:\/\/maven.google.com"##g' build.gradle
Now the repositories part of my build.gradle
looks like this:
google()
jcenter()
}
there is a leftover }
. How can I remove the leftover }
without removing every other closing bracket?
Or is there a better solution than replacing line by line with sed? I have started with sed, but I'm open to any other tool that gets the job done. It should run in a centos container.