Skip to content

Commit b1ecadf

Browse files
committed
Split common mvn exec code to function
And add the -B -U flags to make it work better: * Batch mode avoids any coloration (though probably not an issue here). * Force checking for updates in case new releases are now present and/or any snapshot versions have changed. Avoids cached failures.
1 parent f9d592c commit b1ecadf

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

ci-build.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ escapeXML() {
2828
echo "$1" | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g'
2929
}
3030

31+
mavenEvaluate() {
32+
mvn -B -U -q -Denforcer.skip=true -Dexec.executable=echo -Dexec.args="$1" --non-recursive validate exec:exec 2>&1
33+
}
34+
3135
# Build Maven projects.
3236
if [ -f pom.xml ]; then
3337
echo ::group::"= Maven build ="
@@ -93,7 +97,7 @@ EOL
9397
echo "Performing deployment checks"
9498
deployOK=
9599

96-
scmURL=$(mvn -q -Denforcer.skip=true -Dexec.executable=echo -Dexec.args='${project.scm.url}' --non-recursive validate exec:exec 2>&1)
100+
scmURL=$(mavenEvaluate '${project.scm.url}')
97101
result=$?
98102
checkSuccess $result
99103
if [ $result -ne 0 ]; then
@@ -109,7 +113,7 @@ EOL
109113
echo "No deploy -- repository fork: $BUILD_REPOSITORY != $scmURL"
110114
else
111115
# Are we building a snapshot version, or a release version?
112-
version=$(mvn -q -Denforcer.skip=true -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive validate exec:exec 2>&1)
116+
version=$(mavenEvaluate '${project.version}')
113117
result=$?
114118
checkSuccess $result
115119
if [ $result -ne 0 ]; then
@@ -166,7 +170,7 @@ EOL
166170
fi
167171

168172
# HACK: Use maven-gpg-plugin 3.0.1+. Avoids "signing failed: No such file or directory" error.
169-
maven_gpg_plugin_version=$(mvn -q -Denforcer.skip=true -Dexec.executable=echo -Dexec.args='${maven-gpg-plugin.version}' --non-recursive validate exec:exec 2>&1)
173+
maven_gpg_plugin_version=$(mavenEvaluate '${maven-gpg-plugin.version}')
170174
case "$maven_gpg_plugin_version" in
171175
0.*|1.*|2.*|3.0.0)
172176
echo "--> Forcing maven-gpg-plugin version from $maven_gpg_plugin_version to 3.0.1"

0 commit comments

Comments
 (0)