Skip to content

Commit c548709

Browse files
Maven wrapper improvement
1 parent fd33c2e commit c548709

File tree

4 files changed

+34
-12
lines changed

4 files changed

+34
-12
lines changed

pkg/project/app_classic/Taskfile.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ env:
88
AEM_ENV: '{{.AEM_ENV | default "local"}}'
99
AEM_INSTANCE_PROCESSING_MODE: auto
1010
AEM_OUTPUT_VALUE: NONE
11-
JAVA_HOME:
12-
sh: sh aemw vendor list -V javaHome
11+
AEM_JAVA_ENABLED: true
1312

1413
dotenv:
1514
- '.env' # VCS-ignored, user-specific
@@ -197,9 +196,7 @@ tasks:
197196

198197
aem:build:version:
199198
desc: check build tool versions
200-
cmds:
201-
- echo "JAVA_HOME=${JAVA_HOME}"
202-
- sh mvnw -version
199+
cmd: sh mvnw --version
203200

204201
aem:deploy:
205202
desc: deploy AEM application

pkg/project/app_cloud/Taskfile.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ env:
88
AEM_ENV: '{{.AEM_ENV | default "local"}}'
99
AEM_INSTANCE_PROCESSING_MODE: auto
1010
AEM_OUTPUT_VALUE: NONE
11-
JAVA_HOME:
12-
sh: sh aemw vendor list -V javaHome
11+
AEM_JAVA_ENABLED: true
1312

1413
dotenv:
1514
- '.env' # VCS-ignored, user-specific
@@ -192,9 +191,7 @@ tasks:
192191

193192
aem:build:version:
194193
desc: check build tool versions
195-
cmds:
196-
- echo "JAVA_HOME=${JAVA_HOME}"
197-
- sh mvnw -version
194+
cmd: sh mvnw --version
198195

199196
aem:deploy:
200197
desc: deploy AEM application

pkg/project/common/mvnw

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,35 @@
1818
# under the License.
1919
# ----------------------------------------------------------------------------
2020

21+
# ----------------------------------------------------------------------------
22+
# AEM Compose - Ensure Java is vendored and prepared
23+
# ----------------------------------------------------------------------------
24+
AEM_JAVA_ENABLED=${AEM_JAVA_ENABLED:-true}
25+
if [ "${AEM_JAVA_ENABLED}" = true ]; then
26+
AEM_JAVA_HOME="$(sh aemw vendor list -V javaHome 2>/dev/null || true)"
27+
28+
if [ -z "$AEM_JAVA_HOME" ] || [ ! -d "$AEM_JAVA_HOME" ] || [ ! -x "$AEM_JAVA_HOME/bin/java" ]; then
29+
echo "AEM Compose - Vendor tools not prepared (Java). Preparing now..."
30+
if ! sh aemw vendor prepare; then
31+
rc=$?
32+
echo "AEM Compose - Vendor tools cannot be prepared (exit $rc). Cannot continue!"
33+
echo "Run command 'sh aemw vendor prepare' and inspect the error."
34+
exit $rc
35+
fi
36+
37+
AEM_JAVA_HOME="$(sh aemw vendor list -V javaHome 2>/dev/null || true)"
38+
if [ -z "$AEM_JAVA_HOME" ] || [ ! -d "$AEM_JAVA_HOME" ] || [ ! -x "$AEM_JAVA_HOME/bin/java" ]; then
39+
echo "AEM Compose - Vendor tools cannot be prepared. Cannot continue!"
40+
echo "Run command 'sh aemw vendor prepare' and inspect the error."
41+
exit 1
42+
fi
43+
44+
echo "AEM Compose - Vendor tools prepared. Java available at '${AEM_JAVA_HOME}'"
45+
fi
46+
47+
JAVA_HOME="$AEM_JAVA_HOME"; export JAVA_HOME
48+
fi
49+
2150
# ----------------------------------------------------------------------------
2251
# Apache Maven Wrapper startup batch script, version 3.2.0
2352
#

pkg/project/instance/Taskfile.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ env:
88
AEM_ENV: '{{.AEM_ENV | default "local"}}'
99
AEM_INSTANCE_PROCESSING_MODE: auto
1010
AEM_OUTPUT_VALUE: NONE
11-
JAVA_HOME:
12-
sh: sh aemw vendor list -V javaHome
11+
AEM_JAVA_ENABLED: true
1312

1413
dotenv:
1514
- '.env' # VCS-ignored, user-specific

0 commit comments

Comments
 (0)