You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Christopher Holt (Jira)" <ji...@apache.org> on 2022/11/04 14:11:00 UTC

[jira] [Created] (MWRAPPER-82) mvnw.cmd fails when run from a parent directory.

Christopher Holt created MWRAPPER-82:
----------------------------------------

             Summary: mvnw.cmd fails when run from a parent directory.
                 Key: MWRAPPER-82
                 URL: https://issues.apache.org/jira/browse/MWRAPPER-82
             Project: Maven Wrapper
          Issue Type: Bug
          Components: Maven Wrapper Scripts
         Environment: Windows
            Reporter: Christopher Holt


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.
 
 



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