1 year ago
#387938
Ahmet Yasar
VSCode Maven CommandNotFoundException after setting the environment variables
I tried setting up Maven for VSCode. I could start a maven javafx project and now it gives me this error from the pom.xml file:
org.openjfx:javafx-controls:jar:win:13 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.openjfx:javafx-controls:jar:win:13 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled.
I tried this solution which I couldn't execute:
Step 1: Right Click on your project: Run (As) -> Maven clean
Step 2: Right Click on your project: Run (As) -> Maven install
After which, if the build fails when you do Maven Install, it means there is no web.xml file `under WEB-INF or some problem associated with it.`
When I right click in VSCode on the maven project and click on clean it gives me the error CommandNotFoundException
& : Die Benennung "C:\Java\Maven\apache-maven-3.8.5" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbaren Programms erkannt. Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und wiederholen Sie den Vorgang.
In Zeile:1 Zeichen:3
- & "C:\Java\Maven\apache-maven-3.8.5" clean -f "c:\Users\ahmet\OneDriv ...
+ CategoryInfo : ObjectNotFound: (C:\Java\Maven\apache-maven-3.8.5:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
A tutorial showed me how to set the home variables for maven. I set it like advised:
- M2_HOME to C:\Java\Maven\apache-maven-3.8.5
- MAVEN_BIN to %MAVEN_HOME%\bin
- MAVEN_HOME to %M2_HOME%
Afterwards I was able to call mvn -v in cmd and also in VSCode but I still couldn't clean the Maven project. So I this solution removing the old dependencies which worked in the VSCode command line. It worked but when now calling the clean command it gives me a commandNotFoundExceptopn. So I was wondering how to setup maven properly. The project is located in a OneDrive directory ready on the local disk.
java
maven
visual-studio-code
javafx
installation
0 Answers
Your Answer