-
Couldn't load subscription status.
- Fork 95
Description
Describe the bug
VS Code's "Create Maven Project" command runs on Command Prompt, so it fails on Windows with "The filename, directory name, or volume label syntax is incorrect" error.
To Reproduce
Steps to reproduce the behavior:
- Set
maven.executable.pathas mvn - Add your Maven directory into PATH environment variable
- Use 'Java: Create Java Project -> Maven -> maven-archetype-webapp' to create a project
- See error in terminal
Expected behavior
I found the command was
C:\Users\enoch>cmd.exe /c ""mvn org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate -DarchetypeArtifactId="maven-archetype-webapp" -DarchetypeGroupId="org.apache.maven.archetypes" -DarchetypeVersion="1.4" -DgroupId="com.example" -DartifactId="demo"""
The filename, directory name, or volume label syntax is incorrect.
which I copied in cmd.exe and showed the same error.
The command could succesfully run in PowerShell instead of Command Prompt.
But when I removed the quotation marks like
cmd.exe /c "mvn org.apache.maven.plugins:maven-archetype-plugin:3.1.2:generate -DarchetypeArtifactId="maven-archetype-webapp" -DarchetypeGroupId="org.apache.maven.archetypes" -DarchetypeVersion="1.4" -DgroupId="com.example" -DartifactId="demo""
It worked successfully in Command Prompt.
Environments (please complete the following information as much as possible):
- OS: [Windows 11 24H2]
- VS Code version: [1.103.2]
- Extension version [0.44.0]
Screenshots
Additional context
I recommend that we disable Command Prompt terminal globally in VSCode and use Powershell Only.
Here are some RELATED issues.
#623
#492
https://stackoverflow.com/questions/79736445/vscode-maven-for-java-cant-create-maven-project