devonfw / IDEasy

Tool to automate the setup and updates of a development environment for any project (Successor of devonfw-ide).
Apache License 2.0
8 stars 23 forks source link

Cannot install mvn - failed to create Junction #598

Open hohwille opened 2 months ago

hohwille commented 2 months ago
$ ide mvn clean install
Variable IDE_ROOT is set to 'D:\projects\_ide' but for your project 'IDEasy' the path 'D:\projects' would have been expected.
Deleting corrupted installation at D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3
Artifact already exists at C:\Users\hohwille\Downloads\ide\default\mvn-4.0.0-beta-3.tar.gz
To force update please delete the file and run again.
Checksum 85dfa53ebfcd21e2a29b94eb6e675f617d3b53d3dbe2ed35fb9e07062555762f is correct.
Due to lack of permissions, Microsoft's mklink with junction had to be used to create a Symlink. See https://github.com/devonfw/IDEasy/blob/main/documentation/symlinks.asciidoc for further details. Error was: D:\projects\IDEasy\software\mvn
You are on Windows and you do not have permissions to create symbolic links. Junctions are used as an alternative, however, these can not point to relative paths. So the source (..\..\_ide\software\default\mvn\mvn\4.0.0-beta-3) is interpreted as an absolute path.
Cannot create a file when that file already exists.
Step 'ide (mvn,clean,install)' failed: java.lang.IllegalStateException: Running command 'C:\Windows\System32\cmd.exe' with arguments '/c' 'mklink' '/d' '/j' 'D:\projects\IDEasy\software\mvn' 'D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3' failed: Running command 'C:\Windows\System32\cmd.exe' with arguments '/c' 'mklink' '/d' '/j' 'D:\projects\IDEasy\software\mvn' 'D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3' failed with exit code 1!
 Step 'Install mvn (4.0.0-beta-3)' failed: java.lang.IllegalStateException: Running command 'C:\Windows\System32\cmd.exe' with arguments '/c' 'mklink' '/d' '/j' 'D:\projects\IDEasy\software\mvn' 'D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3' failed: Running command 'C:\Windows\System32\cmd.exe' with arguments '/c' 'mklink' '/d' '/j' 'D:\projects\IDEasy\software\mvn' 'D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3' failed with exit code 1!
2 step(s) failed out of 3 steps.
An unexpected error occurred!
We are sorry for the inconvenience.
Please check the error below, resolve it and try again.
If the error is not on your end (network connectivity, lack of permissions, etc.) please file a bug:
https://github.com/devonfw/ide/issues/new?assignees=&labels=bug&projects=&template=bug.md&title=IllegalStateException%3A+Running+command+%27C%3A%5CWindows%5CSystem32%5Ccmd.exe%27+with+arguments+%27%2Fc%27+%27mklink%27+%27%2Fd%27+%27%2Fj%27+%27D%3A%5Cprojects%5CIDEasy%5Csoftware%5Cmvn%27+%27D%3A%5Cprojects%5C_ide%5Csoftware%5Cdefault%5Cmvn%5Cmvn%5C4.0.0-beta-3%27+failed%3A+Running+command+%27C%3A%5CWindows%5CSystem32%5Ccmd.exe%27+with+arguments+%27%2Fc%27+%27mklink%27+%27%2Fd%27+%27%2Fj%27+%27D%3A%5Cprojects%5CIDEasy%5Csoftware%5Cmvn%27+%27D%3A%5Cprojects%5C_ide%5Csoftware%5Cdefault%5Cmvn%5Cmvn%5C4.0.0-beta-3%27+failed+with+exit+code+1%21
java.lang.IllegalStateException: Running command 'C:\Windows\System32\cmd.exe' with arguments '/c' 'mklink' '/d' '/j' 'D:\projects\IDEasy\software\mvn' 'D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3' failed: Running command 'C:\Windows\System32\cmd.exe' with arguments '/c' 'mklink' '/d' '/j' 'D:\projects\IDEasy\software\mvn' 'D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3' failed with exit code 1!
        at com.devonfw.tools.ide.process.ProcessContextImpl.run(ProcessContextImpl.java:173)
        at com.devonfw.tools.ide.process.ProcessContext.run(ProcessContext.java:132)
        at com.devonfw.tools.ide.io.FileAccessImpl.createWindowsJunction(FileAccessImpl.java:443)
        at com.devonfw.tools.ide.io.FileAccessImpl.symlink(FileAccessImpl.java:470)
        at com.devonfw.tools.ide.io.FileAccess.symlink(FileAccess.java:90)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.doInstall(LocalToolCommandlet.java:100)
        at com.devonfw.tools.ide.tool.LocalToolCommandlet.doInstall(LocalToolCommandlet.java:65)
        at com.devonfw.tools.ide.tool.plugin.PluginBasedCommandlet.doInstall(PluginBasedCommandlet.java:145)
        at com.devonfw.tools.ide.tool.ToolCommandlet.install(ToolCommandlet.java:226)
        at com.devonfw.tools.ide.tool.mvn.Mvn.install(Mvn.java:72)
        at com.devonfw.tools.ide.tool.ToolCommandlet.runTool(ToolCommandlet.java:112)
        at com.devonfw.tools.ide.tool.ToolCommandlet.runTool(ToolCommandlet.java:132)
        at com.devonfw.tools.ide.tool.ToolCommandlet.run(ToolCommandlet.java:89)
        at com.devonfw.tools.ide.context.AbstractIdeContext.applyAndRun(AbstractIdeContext.java:867)
        at com.devonfw.tools.ide.context.AbstractIdeContext.run(AbstractIdeContext.java:779)
        at com.devonfw.tools.ide.cli.Ideasy.runOrThrow(Ideasy.java:89)
        at com.devonfw.tools.ide.cli.Ideasy.run(Ideasy.java:52)
        at com.devonfw.tools.ide.cli.Ideasy.main(Ideasy.java:29)
        at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Caused by: com.devonfw.tools.ide.cli.CliException: Running command 'C:\Windows\System32\cmd.exe' with arguments '/c' 'mklink' '/d' '/j' 'D:\projects\IDEasy\software\mvn' 'D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3' failed with exit code 1!
        at com.devonfw.tools.ide.process.ProcessContextImpl.performLogOnError(ProcessContextImpl.java:289)
        at com.devonfw.tools.ide.process.ProcessContextImpl.run(ProcessContextImpl.java:164)
        ... 18 more

Error: IDEasy failed with exit code 255

Please note that the folder at D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3 exists and looks sane.

hohwille commented 2 months ago

After that I manually created the junction and it worked:

$ cmd.exe /c mklink /d /j 'D:\projects\IDEasy\software\mvn' 'D:\projects\_ide\software\default\mvn\mvn\4.0.0-beta-3'
Microsoft Windows [Version 10.0.22631.4037]
(c) Microsoft Corporation. All rights reserved.
hohwille commented 2 months ago
$ rm mvn

$ ide install mvn
Start: Install mvn
Successfully installed mvn in version 4.0.0-beta-3
Successfully completed ide (install,mvn)

So something was wrong with the existing link or junction. No idea how to reproduce this state...