I'm new to Java and am trying to create my first Maven project. Maven is installed and available on my PATH. I created an empty folder on my desktop where I want the project to be generated, then opened Windows Command Prompt in that folder and ran: `mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.5 -DinteractiveMode=false`. Maven reports that a pom.xml file is required, even though I'm trying to generate the project that should contain the pom.xml. What am I doing wrong?
1 Answer
You don’t need an existing pom.xml to run the archetype generator. Make sure you’re using the command exactly as one line in Command Prompt, and that Maven itself is working with `mvn -version`. You can also call the archetype plugin explicitly, which avoids Maven misinterpreting the goal: `mvn org.apache.maven.plugins:maven-archetype-plugin:3.3.0:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.5 -DinteractiveMode=false`. Run it from the empty parent folder; Maven should create a `my-app` directory containing the pom.xml and source folders.

Since this is Windows Command Prompt, dots in `com.mycompany.app` are fine. The shell-splitting issue mainly applies to other shells, so keep the entire command on one line and don’t add extra punctuation around the options.