Skip to content

Commit a93611e

Browse files
committed
Align archetype workspace version with local snapshot
1 parent b35b6c2 commit a93611e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

scripts/setup-workspace.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ install_jdk() {
104104
printf -v "$dest_var" '%s' "$home"
105105
}
106106

107+
CN1_VERSION=$(awk -F'[<>]' '/<version>/{print $3; exit}' maven/pom.xml)
108+
log "Detected Codename One snapshot version ${CN1_VERSION}"
109+
107110
log "Ensuring JDK 8 is available"
108111
if [ -z "${JAVA_HOME:-}" ] || [ ! -x "$JAVA_HOME/bin/java" ] || ! "$JAVA_HOME/bin/java" -version 2>&1 | grep -q '8\.0'; then
109112
log "Provisioning JDK 8..."
@@ -215,6 +218,15 @@ fi
215218
set -e
216219

217220
if [ "${skip_archetypes:-0}" -eq 0 ]; then
218-
(cd cn1-maven-archetypes && "$MAVEN_HOME/bin/mvn" -DskipTests -DskipITs=true -Dinvoker.skip=true install) || \
219-
log "Archetype mvn install failed; continuing."
221+
(
222+
cd cn1-maven-archetypes
223+
current_version=$("$MAVEN_HOME/bin/mvn" -q -DforceStdout help:evaluate -Dexpression=project.version | tr -d '\r' | tail -n 1)
224+
if [ -z "$current_version" ]; then
225+
log "Unable to determine cn1-maven-archetypes version; proceeding with defaults"
226+
elif [ "$current_version" != "$CN1_VERSION" ]; then
227+
log "Updating cn1-maven-archetypes version from $current_version to $CN1_VERSION to match local snapshot"
228+
"$MAVEN_HOME/bin/mvn" -q -B versions:set -DnewVersion="$CN1_VERSION" -DgenerateBackupPoms=false
229+
fi
230+
"$MAVEN_HOME/bin/mvn" -DskipTests -DskipITs=true -Dinvoker.skip=true install
231+
) || log "Archetype mvn install failed; continuing."
220232
fi

0 commit comments

Comments
 (0)