maven-wrapper icon indicating copy to clipboard operation
maven-wrapper copied to clipboard

[MWRAPPER-122] Mingw paths problem on Windows

Open jira-importer opened this issue 1 year ago • 2 comments

Krystian Panek opened MWRAPPER-122 and commented

When I call the Maven wrapper from Taskfile.dev then only on Windows in GitBash (on Mac and Linux works without problems) the following command is executed (I just replaced the last "exec" statement with "echo" to troubleshoot):

/c/Program Files/Eclipse Adoptium/jdk-11.0.14.101-hotspot/bin/java -classpath C:\Projects\acme-aem-acme-mono-ad86003b367a/.mvn/wrapper/maven-wrapper.jar -Dmaven.multiModuleProjectDirectory=C:\Projects\acme-aem-acme-mono-ad86003b367a org.apache.maven.wrapper.MavenWrapperMain clean install -N

Note that bad path separators are generated and my task execution results in an error:

task: [aem:build:root] sh mvnw clean install -N && mkdir -p target && touch target/done.txt
Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
task: Failed to run task "aem:build:root": exit status 1

To fix the problem I needed to update the code:

1. For Cygwin, switch paths to Windows format before running java
if $cygwin; then

to the following:

1. For Cygwin or Mingw, switch paths to Windows format before running java 
if [ "$cygwin" = true ] || [ "$mingw" = true ]; then

then I have a working exec command generated:

/c/Program Files/Eclipse Adoptium/jdk-11.0.14.101-hotspot/bin/java -classpath /c/Projects/acme-aem-acme-mono-ad86003b367a/.mvn/wrapper/maven-wrapper.jar -Dmaven.multiModuleProjectDirectory=/c/Projects/acme-aem-acme-mono-ad86003b367a org.apache.maven.wrapper.MavenWrapperMain clean install -N

It would be nice to make the "mvnw script work in more use cases. by introducing the fix like the above or similar making my integration work without problems. 

 

Greetings, Krystian


No further details from MWRAPPER-122

jira-importer avatar Jan 16 '24 11:01 jira-importer

Michael Osipov commented

Does this happen in the actual mvn script as well?

jira-importer avatar Jan 16 '24 11:01 jira-importer

Krystian Panek commented

just calling

sh mvnw --version

works but when the same is called through taskfile does not.

I checked that in both cases "uname" returns "Linux" so pretty strange.

 

jira-importer avatar Jan 16 '24 14:01 jira-importer