wttech / aemc

AEM Compose (Core & CLI)
https://wttech.blog/blog/2023/get-your-aem-together-with-aem-compose/
Apache License 2.0
40 stars 5 forks source link

Maven Not Bundled with Setup #252

Open mitchross opened 4 months ago

mitchross commented 4 months ago

Why is Maven and Node not bundled? Since the JDK is already downloaded, it seems natural to have at least a maven binary downloaded as well? Node for front end? ( although I could argue this is not needed )

image
krystian-panek-vmltech commented 4 months ago

Yep, in some setups I have already used Maven Wrapper. It is not as straightforward as it looks at a glance. Mostly due to https://github.com/go-task/task/issues/1038#issuecomment-1892097343 . Without having this resolved, having Java/Maven bundled when initializing AEMC in the project may not look as simple as it should be. That's why till now it's not bundled. The solution I know and is working properly looks a little bit hackish for me and that's why I am avoiding sharing it broader.

krystian-panek-vmltech commented 4 months ago

for now to satisfy your potential curiosity ;) due to mentioned Taskfile limitation I have it organized in the following way:

Taskfile.yml has a new task that need to be run once right after cloning the AEM project:

  aem:init:
    desc: initialize AEM prerequisites
    cmds:
      - sh aemw instance init
      - mkdir -p var
      - sh aemw instance init --output-value javaHome > var/java_home.txt

mvnw script (from official Maven Wrapper distro) has following addition in the beginning:

script_dir=$(dirname "$0")
if [ -f "${script_dir}/var/java_home.txt" ]; then
    export JAVA_HOME=$(cat "${script_dir}/var/java_home.txt")
fi

plus few if statements are "improved" because they are not working properly on Windows+Git Bash:

  if $cygwin; then

are changed to

if [ "$cygwin" = true ] || [ "$mingw" = true ]; then

finally, in the Taskfile instead of calling mvn I am calling script mvnw which uses Java managed by AEMC

mitchross commented 4 months ago

Interesting. Thanks for the acknowledgement.