Skip to content

Commit

Permalink
! improve integration-test.sh: extract archetypeVersion from pom.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed Jan 4, 2021
1 parent e042e1e commit ae536e6
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions scripts/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,41 +103,63 @@ MVN() {
(
headInfo "CI: archetype:generate by cola-framework-archetype-service"

demo_dir="cola-archetypes/target/cola-framework-archetype-service-demo"
# NOTE: DO NOT declare archetypeVersion var as readonly!!
# readonly declaration make exit code of assignment to be always 0,
# aka. the exit code of command in subshell is discarded.
# tested on bash 3.2.57/4.2.46
archetypeVersion=$(
grep '<version>.*</version>' cola-archetypes/cola-archetype-service/pom.xml |
awk -F'</?version>' 'NR==1 {print $2}'
)

readonly demo_dir="cola-archetypes/target/cola-framework-archetype-service-demo"
mkdir -p "$demo_dir"
cd "$demo_dir"

artifactId=demo-service
readonly artifactId=demo-service

MVN archetype:generate \
-DgroupId=com.alibaba.cola.demo.archetype-service -DartifactId=$artifactId -Dversion=1.0.0-SNAPSHOT \
-DgroupId=com.alibaba.cola.demo.archetype-service -DartifactId="$artifactId" -Dversion=1.0.0-SNAPSHOT \
-Dpackage=com.alibaba.cola.demo.service \
-DarchetypeGroupId=com.alibaba.cola \
-DarchetypeArtifactId=cola-framework-archetype-service \
-DarchetypeVersion=4.0.0 \
-DarchetypeVersion="$archetypeVersion" \
-DarchetypeCatalog=local \
-DinteractiveMode=false

cd $artifactId
cd "$artifactId"
MVN install
)


(
headInfo "CI: archetype:generate by cola-framework-archetype-web"

demo_dir="cola-archetypes/target/cola-framework-archetype-web-demo"
# NOTE: DO NOT declare archetypeVersion var as readonly!!
# readonly declaration make exit code of assignment to be always 0,
# aka. the exit code of command in subshell is discarded.
# tested on bash 3.2.57/4.2.46
archetypeVersion=$(
grep '<version>.*</version>' cola-archetypes/cola-archetype-web/pom.xml |
awk -F'</?version>' 'NR==1 {print $2}'
)

readonly demo_dir="cola-archetypes/target/cola-framework-archetype-web-demo"
mkdir -p "$demo_dir"
cd "$demo_dir"

artifactId=demo-web
readonly artifactId=demo-web

MVN archetype:generate \
-DgroupId=com.alibaba.cola.demo.archetype-web -DartifactId=$artifactId -Dversion=1.0.0-SNAPSHOT \
-DgroupId=com.alibaba.cola.demo.archetype-web -DartifactId="$artifactId" -Dversion=1.0.0-SNAPSHOT \
-Dpackage=com.alibaba.cola.demo.web \
-DarchetypeGroupId=com.alibaba.cola \
-DarchetypeArtifactId=cola-framework-archetype-web \
-DarchetypeVersion=4.0.0 \
-DarchetypeVersion="$archetypeVersion" \
-DarchetypeCatalog=local \
-DinteractiveMode=false

cd $artifactId
cd "$artifactId"
MVN install
)

Expand Down

0 comments on commit ae536e6

Please sign in to comment.