Why does Maven ask for a pom.xml when I try to generate a new project?

0
1
Asked By QuietMaple42 On

I'm new to Java and am trying to create my first Maven project on Windows. Maven is installed and available in Command Prompt. I created a folder on my Desktop where I want to keep my projects, changed into that folder, and ran:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.5 -DinteractiveMode=false

However, Maven reports that a pom.xml file is required in the current directory. I thought the archetype command was supposed to generate the project and create the pom.xml automatically. What am I doing wrong?

1 Answer

Answered By CobaltLynx7 On

The command itself should be run from an empty parent folder; you do not need an existing pom.xml to generate a project. Since you’re using Windows Command Prompt, put the whole command on one line and make sure the arguments are passed exactly as shown. Command Prompt generally handles the dotted groupId normally, unlike some other shells that may split or interpret parts of the argument. Maven should create a new `my-app` directory containing the generated pom.xml and source folders.

QuietMaple42 -

You mentioned that you’re using Windows Command Prompt, so the shell probably isn’t the issue. If the same error continues, verify that the command is exactly `mvn archetype:generate` and that you are running it from the intended parent directory, not from a partially created Maven project.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.