Skip to content

Commit eda12d9

Browse files
committed
Fix for central deployment
1 parent 908f570 commit eda12d9

File tree

2 files changed

+14
-34
lines changed

2 files changed

+14
-34
lines changed

mvnw

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,27 @@ distributionUrlNameMain="${distributionUrlNameMain%-bin}"
145145
MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
146146
MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
147147

148+
echo "Running version check"
149+
VERSION=$( sed '\!<parent!,\!</parent!d' `dirname $0`/pom.xml | grep '<version' | head -1 | sed -e 's/.*<version>//' -e 's!</version>.*$!!' )
150+
echo "The found version is [${VERSION}]"
151+
152+
MAVEN_ARGS=${MAVEN_ARGS:-}
153+
if echo $VERSION | egrep -q '[0-9]*\.[0-9]*\.[0-9]*$|RELEASE|-M|-RC'; then
154+
echo Activating \"central\" profile for version=\"$VERSION\"
155+
echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pcentral"
156+
else
157+
echo Deactivating \"central\" profile for version=\"$VERSION\"
158+
echo $MAVEN_ARGS | grep -q central && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pcentral//')
159+
fi
160+
148161
exec_maven() {
149162
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
150163
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
151164
}
152165

153166
if [ -d "$MAVEN_HOME" ]; then
154167
verbose "found existing MAVEN_HOME at $MAVEN_HOME"
155-
exec_maven "$@"
168+
exec_maven $MAVEN_ARGS "$@"
156169
fi
157170

158171
case "${distributionUrl-}" in
@@ -291,26 +304,5 @@ verbose "Found extracted Maven distribution directory: $actualDistributionDir"
291304
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url"
292305
mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
293306

294-
echo "Running version check"
295-
VERSION=$( sed '\!<parent!,\!</parent!d' `dirname $0`/pom.xml | grep '<version' | head -1 | sed -e 's/.*<version>//' -e 's!</version>.*$!!' )
296-
echo "The found version is [${VERSION}]"
297-
298-
MAVEN_ARGS=${MAVEN_ARGS:-}
299-
if echo $VERSION | egrep -q 'M|RC'; then
300-
echo Activating \"milestone\" profile for version=\"$VERSION\"
301-
echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pmilestone"
302-
else
303-
echo Deactivating \"milestone\" profile for version=\"$VERSION\"
304-
echo $MAVEN_ARGS | grep -q milestone && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pmilestone//')
305-
fi
306-
307-
if echo $VERSION | egrep -q '[0-9]*\.[0-9]*\.[0-9]*$|RELEASE'; then
308-
echo Activating \"central\" profile for version=\"$VERSION\"
309-
echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pcentral"
310-
else
311-
echo Deactivating \"central\" profile for version=\"$VERSION\"
312-
echo $MAVEN_ARGS | grep -q central && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pcentral//')
313-
fi
314-
315307
clean || :
316308
exec_maven $MAVEN_ARGS "$@"

pom.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -441,18 +441,6 @@
441441
</repository>
442442
</distributionManagement>
443443
</profile>
444-
<profile>
445-
<id>milestone</id>
446-
<distributionManagement>
447-
<repository>
448-
<id>repo.spring.io</id>
449-
<url>https://repo.spring.io/libs-milestone-local</url>
450-
<snapshots>
451-
<enabled>false</enabled>
452-
</snapshots>
453-
</repository>
454-
</distributionManagement>
455-
</profile>
456444
<profile>
457445
<id>central</id>
458446
<build>

0 commit comments

Comments
 (0)