Home > Blockchain >  How can I generate a parent POM file using Maven?
How can I generate a parent POM file using Maven?

Time:09-11

I'm trying to build a Enter image description here

Am I missing anything?

CodePudding user response:

You're not missing anything. You may not have run the command line command correctly.

The same command works for me:

mvn archetype:generate -DgroupId=com.baeldung -DartifactId=parent-project

Result:

[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: basedir, Value: C:\dev\testing
[INFO] Parameter: package, Value: com.baeldung
[INFO] Parameter: groupId, Value: com.baeldung
[INFO] Parameter: artifactId, Value: parent-project
[INFO] Parameter: packageName, Value: com.baeldung
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: C:\dev\testing\parent-project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  45.571 s
[INFO] Finished at: 2022-09-09T11:16:06 02:00
[INFO] ------------------------------------------------------------------------

Check also the version of mvn you have installed

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: C:\apache-maven-3.8.1
Java version: 11.0.12, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-11.0.12
Default locale: no_NO, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

CodePudding user response:

I have finally realized that my PowerShell environment will interpret into the wrong command. So the correct command in PowerShell should be:

mvn archetype:generate '-DgroupId=com.baeldung' '-DartifactId=parent-project'

If I put the original command in a Command Prompt, it will not produce any error.

See also: How to disable/override PowerShell dot notation

  • Related