I am using Windows and Git Bash. My maven command is set in Environment Variables and is able to execute in any directory of my command line.
But I wrote a bash script and it cannot find my mvn
command!
Code:
#!/bin/bash
echo $MAVEN_HOME
#export PATH=$PATH:/c/Users/user/Documents/dev/Tools/apache-maven-3.9.1-bin/apache-maven-3.9.1/bin/
parent_dir="/c/Users/user/Documents/Entwicklung"
echo $parent_dir
# Iterate through subdirectories
for dir in "${parent_dir}"/*/; do
echo "compiling: ${dir}"
# Execute a command in each subdirectory
cd "${dir}"
# Replace "command" with the command you want to execute
"/c/Users/user/Documents/Entwicklung/Tools/apache-maven-3.9.1-bin/apache-maven-3.9.1/bin/mvn compile"
"C:\Users\user\Documents\Entwicklung\Tools\apache-maven-3.9.1-bin\apache-maven-3.9.1\bin\mvn compile"
done
As you can see I try to execute the mvn in Style of Windows Path and Style of Linux Path. But Bash is not able to find the command:
./compile-mms_2.sh: line 15: /c/Users/user/Documents/Entwicklung/Tools/apache-maven-3.9.1-bin/apache-maven-3.9.1/bin/mvn compile: No such file or directory
./compile-mms_2.sh: line 16: C:\Users\user\Documents\Entwicklung\Tools\apache-maven-3.9.1-bin\apache-maven-3.9.1\bin\mvn compile: No such file or directory
Like I told before, on the command line I can execute my mvn from any directory!
Someone maybe have an idea or a hint?