apache / apache/maven-wrapper

[MWRAPPER-82] mvnw.cmd fails when run from a parent directory.

Open
#247 0 comments 0 reactions 0 assignees View on GitHub
bug priority:minor
Dominant language
Java
Stars
254
Forks
78
Avg merge
5h 26m
Merged PRs (30d)
2

Description

**[Christopher Holt](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER297975)** opened **[MWRAPPER-82](https://issues.apache.org/jira/browse/MWRAPPER-82?redirect=false)** and commented

running "c:\project\module\mvn.cmd" from "c:\project" will fail like this:

 
The system cannot find the file C:\project\.mvn\wrapper\maven-wrapper.properties
 

It should look in c:\project\module, not c:\project for the .mvn folder. 

 

This works fine with the mvnw sh script under linux.

 

Under liniux, the sh script starts from "dirname $0" looking for .mvn.  The cmd script starts from "%CD%".  wrapping this line:

 
set EXEC_DIR=%CD%
 
with pushd/popd calls fixes the problem.
 
i.e:
 
pushd %~dp0
set EXEC_DIR=%CD%
popd
 
Since this script is created and added to version control for the project, the workaround is to simply fix the generated scipt.
 
 

---

**Issue Links:**
- [CAMEL-21662](https://issues.apache.org/jira/browse/CAMEL-21662) Camel JBang - run with Spring boot / Quarkus fails on Windows

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.