You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (Jira)" <ji...@apache.org> on 2022/11/16 22:31:00 UTC
[jira] [Comment Edited] (MWRAPPER-83) mvnw fails in zsh due to empty MAVEN_OPTS variable
[ https://issues.apache.org/jira/browse/MWRAPPER-83?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17635026#comment-17635026 ]
Michael Osipov edited comment on MWRAPPER-83 at 11/16/22 10:30 PM:
-------------------------------------------------------------------
The wrapper script is a Bourne shell script targeted at standard POSIX shells. zsh is neither a Bourne shell nor fully POSIX compliant. See: https://zsh.sourceforge.io/Doc/zsh_a4.pdf
Install a POSIX shell.
was (Author: michael-o):
The wrapper script is a Bourne shell script targeted at standard POSIX shells. zsh is neither a Bourne shell not fully POSIX compliant. See: https://zsh.sourceforge.io/Doc/zsh_a4.pdf
Install a POSIX shell.
> mvnw fails in zsh due to empty MAVEN_OPTS variable
> --------------------------------------------------
>
> Key: MWRAPPER-83
> URL: https://issues.apache.org/jira/browse/MWRAPPER-83
> Project: Maven Wrapper
> Issue Type: Bug
> Components: Maven Wrapper Scripts
> Affects Versions: 3.1.1
> Reporter: Scott Kurz
> Priority: Major
>
> Running mvnw in zsh, I get:
> {quote}*Error: Could not find or load main class*
> *Caused by: java.lang.ClassNotFoundException:*
> {quote}
> h4. 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.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)