Skip to content

[MWRAPPER-161] Fails to run when executed using sh #305

Description

@jira-importer

Volkan Yazici opened MWRAPPER-161 and commented

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:

sh mvnw
mvnw: 109: cannot open mvnw/.mvn/wrapper/maven-wrapper.properties: No such file

due to the following line:

"${0%/*}/.mvn/wrapper/maven-wrapper.properties"

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: openjdk/jmh#154


Affects: 3.3.2

Activity

  1. jira-importer commented on Apr 4, 2025

    @jira-importer
    Author

    Piotr Karwasz commented

    I guess that

    "$(dirname "$0")/.mvn/wrapper/maven-wrapper.properties"

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

  2. added a commit that references this issue on Jun 16, 2025
    a8ee3ec
  3. added this to the 3.3.3 milestone on Jul 8, 2025
  4. added a commit that references this issue on Jul 9, 2025
    2bc6f84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingpriority:majorMajor loss of function

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions