Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I setup VSCODE to create Maven projects?

I recently installed Visual Studio Code and am now trying to create a Maven project. When I first tried to create a Maven project, I received an error about the JAVA_HOME setting, so I fixed that. Next I received an error saying it couldn't find an executable or script file in the Maven > Executable: Path folder. I disabled the setting named Maven > Executable: Prefer Maven Wrapper, and then I changed found the mvnw.cmd file and added the path to that folder to my settings (shown below):

C:\Users\user1\.vscode\extensions\vscjava.vscode-maven-0.21.4\resources\maven-wrapper

Now when I try to create the Maven project, I just get the following in TERMINAL window and no project is created:

>> cd "c:\Users\user1\Documents\Bidi\Source\Maven"
>> & "C:\Users\user1\.vscode\extensions\vscjava.vscode-maven-0.21.4\resources\maven-wrapper\" org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate -DarchetypeArtifactId="maven-archetype-quickstart" -DarchetypeGroupId="org.apache.maven.archetypes" -DarchetypeVersion="1.4"
>> "

Has anyone seen this problem and figured out how to fix it?

like image 726
Tim Avatar asked Jun 03 '20 00:06

Tim


1 Answers

I was finally able to resolve the issue. After looking at Microsoft's troubleshooting page on GitHub here (https://github.com/microsoft/vscode-maven/blob/master/Troubleshooting.md), I searched for folders containing "apache-maven". I was then able to find the folder with the mvn file. I then entered the full path, including the file name in the maven.executable.path property and it worked. The full path was like this:

C:\Users\user1\.m2\wrapper\dists\apache-maven-3.6.3-bin\abc123abc123abc123XX\apache-maven-3.6.3\bin\mvn
like image 58
Tim Avatar answered Oct 03 '22 15:10

Tim