Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Invalid
-
3.1.1
-
None
-
None
Description
Running mvnw in zsh, I get:
Error: Could not find or load main class
Caused by: java.lang.ClassNotFoundException:
Recreate Instructions
- docker run -it ubuntu:focal-20221019 # next instructions are within Docker container
- apt update; apt install default-jdk maven zsh -y # still have to interactively make a location selection
- export JAVA_HOME=/usr
- mvn -B archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-simple -DarchetypeVersion=1.4 -DgroupId=demo -DartifactId=app -Dversion=1.0
- cd app
- mvn org.apache.maven.plugins:maven-wrapper-plugin:3.1.1:wrapper
- bash mvnw validate # good, works
- zsh mvnw validate # bad, recreates problem
Thoughts{}
The problem centers around the different behavior of bash, zsh (at least with the versions in this recreate) in interpreting the expansion of the "empty" MAVEN_OPTS variable. With bash this gets resolved to nothing whereas in zsh this is resolved to a ' ' string, which the java executable seems to treat as the main class argument, and thus fails.
Maybe someone more familiar with shell options knows a workaround, but given this seems to happen with the default options in the above environment, it seems worth addressing in the script.
Attachments
Issue Links
- causes
-
MWRAPPER-84 Update documentation about shells
- Closed