Skip to content

"Create Maven Project" command fails on Command Prompt with "The filename, directory name, or volume label syntax is incorrect" error #1101

@EnochxynL

Description

@EnochxynL

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:

  1. Set maven.executable.path as mvn
  2. Add your Maven directory into PATH environment variable
  3. Use 'Java: Create Java Project -> Maven -> maven-archetype-webapp' to create a project
  4. 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

Image Image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-triagedbugSomething isn't workingduplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions