Skip to content

Commit d5ee06b

Browse files
committed
Preload archetype plugin in Android sample build
1 parent 7552c08 commit d5ee06b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

scripts/build-android-app.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,21 @@ MAIN_NAME="HelloCodenameOne"
106106

107107
LOCAL_MAVEN_REPO="${LOCAL_MAVEN_REPO:-$HOME/.m2/repository}"
108108
ba_log "Using local Maven repository at $LOCAL_MAVEN_REPO"
109+
mkdir -p "$LOCAL_MAVEN_REPO"
109110
MAVEN_CMD=("$MAVEN_HOME/bin/mvn" -Dmaven.repo.local="$LOCAL_MAVEN_REPO")
110111

112+
ARCHETYPE_PLUGIN_VERSION="3.2.1"
113+
ARCHETYPE_PLUGIN_JAR="$LOCAL_MAVEN_REPO/org/apache/maven/plugins/maven-archetype-plugin/$ARCHETYPE_PLUGIN_VERSION/maven-archetype-plugin-$ARCHETYPE_PLUGIN_VERSION.jar"
114+
115+
if [ ! -f "$ARCHETYPE_PLUGIN_JAR" ]; then
116+
ba_log "Preloading Maven archetype plugin version $ARCHETYPE_PLUGIN_VERSION into $LOCAL_MAVEN_REPO"
117+
if ! xvfb-run -a "${MAVEN_CMD[@]}" -B org.apache.maven.plugins:maven-archetype-plugin:"$ARCHETYPE_PLUGIN_VERSION":help -Ddetail -Dgoal=generate; then
118+
ba_log "Failed to cache maven-archetype-plugin $ARCHETYPE_PLUGIN_VERSION; archetype generation may download dependencies" >&2
119+
fi
120+
else
121+
ba_log "Maven archetype plugin $ARCHETYPE_PLUGIN_VERSION already cached"
122+
fi
123+
111124
ba_log "Generating Codename One application skeleton"
112125
xvfb-run -a "${MAVEN_CMD[@]}" -q --offline archetype:generate \
113126
-DarchetypeArtifactId=cn1app-archetype \

0 commit comments

Comments
 (0)