Skip to content

mvnw.cmd does not work when $MAVEN_M2_PATH path is hidden on Windows #370

@marshalhayes

Description

@marshalhayes

Affected version

3.3.3

Bug description

When using mvnw.cmd on Windows where $MAVEN_M2_PATH is hidden, running mvnw.cmd results in the following error:

Get-Item : Could not find item C:\Users\Marshal\.m2.
At line:92 char:6
+ if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) {
+      ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\Marshal\.m2:String) [Get-Item], IOException
    + FullyQualifiedErrorId : ItemNotFound,Microsoft.PowerShell.Commands.GetItemCommand
ECHO is on.
Cannot start maven from wrapper  

Steps to reproduce:

  • Hide $MAVEN_M2_PATH: Right-click the folder in Explorer, choose Properties, then check the Hidden box
  • Run mvnw.cmd

Possible workarounds/solutions:

  • I like having ~/.m2 hidden, but unhiding solves this issue
  • Alternatively, adding -Force to the Get-Item call (which is what I did) (see here) solve this issue

It looks like this may have been introduced by #143.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions