Why does Maven ask for a pom.xml when generating a new project?

0
2
Asked By SunnyOrbit42 On

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

Answered By MapleFox_73 On

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.

QuietLemon18 -

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.

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.