[ 
https://issues.apache.org/jira/browse/MWRAPPER-161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17940983#comment-17940983
 ] 

Piotr Karwasz edited comment on MWRAPPER-161 at 4/4/25 2:04 PM:
----------------------------------------------------------------

I guess that

{code:sh}
"$(dirname "$0")/.mvn/wrapper/maven-wrapper.properties"
{code}

should be used instead of the variable expansion. It is POSIX-2008, so it 
should work in all environments.


was (Author: pkarwasz):
I guess that {{dirname "$0"}} should be used instead of the variable expansion. 
It is POSIX-2008, so it should work in all environments.

> Fails to run when executed using `sh`
> -------------------------------------
>
>                 Key: MWRAPPER-161
>                 URL: https://issues.apache.org/jira/browse/MWRAPPER-161
>             Project: Maven Wrapper
>          Issue Type: Bug
>          Components: Maven Wrapper Scripts
>    Affects Versions: 3.3.2
>            Reporter: Volkan Yazici
>            Priority: Major
>
> Several projects don't allow executable files in their version control system 
> due to platform compatibility concerns. For instance, OpenJDK doesn't allow 
> executables to be committed in Git repositories[1]. Hence, Maven Wrapper 
> should be runnable as an argument to `sh`, though it is not:
> {code}
> sh mvnw
> mvnw: 109: cannot open mvnw/.mvn/wrapper/maven-wrapper.properties: No such 
> file
> {code}
> due to the following line:
> {code}
> "${0%/*}/.mvn/wrapper/maven-wrapper.properties"
> {code}
> I expect there to be more issues due to `$0` usage assuming the script is 
> executed as an executable – did not check.
>  
> [1] See the `Executable files are not allowed (file: mvnw)` error generated 
> by the Skara bot of OpenJDK in this PR attempting to integrate Maven Wrapper 
> to JMH: https://github.com/openjdk/jmh/pull/154



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to