Skip to content

Commit

Permalink
[SHRINKRES-317] Find a way to update all poms in all subdirectories
Browse files Browse the repository at this point in the history
  • Loading branch information
petrberan committed Nov 24, 2023
1 parent 8158762 commit 2d88590
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dependency-version-bump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
file="$(pwd)/pom.xml"
while read -r line
do
if [[ $line == "<version."* ]]; then
value="${line%<*}"; value="${value#*>}"
dependency="${line%%>*}"; dependency="${dependency:1}"
printf "Checking version of ${dependency#*.} with value ${value} in other pom.xmls\n"
find . -type f -name "*pom*.xml" -exec sed -i'' -e "s/<${dependency}>.*<\/${dependency}>/<${dependency}>${value}<\/${dependency}>/" {} +
fi
if [[ $line == "</properties>" ]]; then
break
fi
done <"$file"
34 changes: 34 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,40 @@
</plugins>
</build>
</profile>

<profile>
<id>dependency-version-bump-unix</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<inherited>false</inherited>
<executions>
<execution>
<id>run-script</id>
<phase>initialize</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sh</executable>
<arguments>
<argument>dependency-version-bump.sh</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>

0 comments on commit 2d88590

Please sign in to comment.