Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven - How to create a pom.xml for java project through command line

Tags:

java

xml

maven

Currently working on a work training on Maven. I've never used it before and the training is very limited. One of the assessments is asking me to do the following using command line.

  1. Create a new Directory in a local storage.
  2. Place the downloaded project in this directory and create maven build file(pom.xml).**
  3. In pom.xml file create a project element, In project element create default elements such as modelVersion,groupId,artifactId,packaging,version,name for project

Its the number 2 I can't seem to get write. I know how to create a new maven project using command line(below), however when I try to create the pom.xml for a project, it doesn't work.

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

Any help would be great thanks.

like image 851
KLP Avatar asked Aug 01 '26 16:08

KLP


1 Answers

You can run mvn archetype:generate without parameters. Maven will ask about your project and generate the POM.

like image 66
felipecrp Avatar answered Aug 03 '26 04:08

felipecrp