Skip to content

Make only-mvnw.cmd pick the first matching extracted directory (#442) - #447

Open
tanvir-ux wants to merge 1 commit into
apache:masterfrom
tanvir-ux:fix-442-first-match-extracted-dir
Open

Make only-mvnw.cmd pick the first matching extracted directory (#442)#447
tanvir-ux wants to merge 1 commit into
apache:masterfrom
tanvir-ux:fix-442-first-match-extracted-dir

Conversation

@tanvir-ux

Copy link
Copy Markdown

When the extracted archive directory name does not match the archive filename, both wrapper scripts scan for a subdirectory that contains bin/$MVN_CMD. Unix only-mvnw already stops at the first match. only-mvnw.cmd used ForEach-Object with no early exit, so the last match won.

I changed the Windows scan to a foreach with break so both scripts pick the same directory from the same archive.

Fixes #442

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its verify).

This is a few-line script change in only-mvnw.cmd. I did not add a PowerShell test harness.

Unix only-mvnw already stops at the first directory that contains bin/$MVN_CMD. The Windows script kept scanning and used the last match, so the two scripts could select different distributions from the same archive.

Fixes apache#442
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mvnw.cmd selects the last matching extracted directory while mvnw selects the first

1 participant