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

IDEasy requires git but does not verify if git is installed #587

Open hohwille opened 2 months ago

hohwille commented 2 months ago

IDEasy has git as prerequisite. Hence, it should check if git is installed and otherwise give a reasonable error message or even better suggest to download and install git.

C:\projects>ide create example
Creating new IDEasy project in C:\projects\_ide\example
Start: Clone settings repository
Missing your settings at C:\projects\_ide\example\settings and no SETTINGS_URL is defined.
Further details can be found here: https://github.com/devonfw/IDEasy/blob/main/documentation/settings.asciidoc
Please contact the technical lead of your project to get the SETTINGS_URL for your project.
In case you just want to test IDEasy you may simply hit return to install the default settings.
Settings URL [https://github.com/devonfw/ide-settings.git]:

Step 'Clone settings repository' ended with failure.
Step 'ide (create,example)' failed: java.lang.IllegalStateException: Running command 'git' with arguments 'clone' '--recursive' 'https://github.com/devonfw/ide-settings.git' '--config' 'core.autocrlf=false' '.' failed: Cannot run program "git" (in directory "C:\projects\_ide\example\settings"): CreateProcess error=2, The system cannot find the file specified
 Step 'Clone settings repository' failed: null
2 step(s) failed out of 2 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+%27git%27+with+arguments+%27clone%27+%27--recursive%27+%27https%3A%2F%2Fgithub.com%2Fdevonfw%2Fide-settings.git%27+%27--config%27+%27core.autocrlf%3Dfalse%27+%27.%27+failed%3A+Cannot+run+program+%22git%22+%28in+directory+%22C%3A%5Cprojects%5C_ide%5Cexample%5Csettings%22%29%3A+CreateProcess+error%3D2%2C+The+system+cannot+find+the+file+specified
java.lang.IllegalStateException: Running command 'git' with arguments 'clone' '--recursive' 'https://github.com/devonfw/ide-settings.git' '--config' 'core.autocrlf=false' '.' failed: Cannot run program "git" (in directory "C:\projects\_ide\example\settings"): CreateProcess error=2, The system cannot find the file specified
        at com.devonfw.tools.ide.process.ProcessContextImpl.run(ProcessContextImpl.java:173)
        at com.devonfw.tools.ide.context.GitContextImpl.clone(GitContextImpl.java:238)
        at com.devonfw.tools.ide.context.GitContextImpl.pullOrClone(GitContextImpl.java:194)
        at com.devonfw.tools.ide.context.GitContextImpl.pullOrClone(GitContextImpl.java:164)
        at com.devonfw.tools.ide.commandlet.AbstractUpdateCommandlet.updateSettings(AbstractUpdateCommandlet.java:128)
        at com.devonfw.tools.ide.commandlet.AbstractUpdateCommandlet.run(AbstractUpdateCommandlet.java:46)
        at com.devonfw.tools.ide.commandlet.CreateCommandlet.run(CreateCommandlet.java:61)
        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: java.io.IOException: Cannot run program "git" (in directory "C:\projects\_ide\example\settings"): CreateProcess error=2, The system cannot find the file specified
        at java.base@21.0.2/java.lang.ProcessBuilder.start(ProcessBuilder.java:1170)
        at java.base@21.0.2/java.lang.ProcessBuilder.start(ProcessBuilder.java:1089)
        at com.devonfw.tools.ide.process.ProcessContextImpl.run(ProcessContextImpl.java:147)
        ... 12 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions$NewObjectWithObjectArrayArgFunctionPointer.invoke(JNIFunctions.java)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions.ThrowNew(JNIFunctions.java:907)
        at java.base@21.0.2/java.lang.ProcessImpl.create(Native Method)
        at java.base@21.0.2/java.lang.ProcessImpl.<init>(ProcessImpl.java:500)
        at java.base@21.0.2/java.lang.ProcessImpl.start(ProcessImpl.java:159)
        at java.base@21.0.2/java.lang.ProcessBuilder.start(ProcessBuilder.java:1126)
        ... 14 more

You are not inside an IDE installation: C:\projects
IDE environment variables have been set for  in workspace