"mvn archetype:generate" - Generate Maven Project


How to generate a new Maven project?

✍: FYIcenter.com


You can run the "mvn archetype:generate" command to generate a standard Maven project:

C:\fyicenter>\fyicenter\apache-maven-3.5.4\bin\mvn archetype:generate 
   -DartifactId=hello -DgroupId=com.fyicenter 

[INFO] Scanning for projects...
[INFO] ------------------ org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] >>> maven-archetype-plugin:3.0.1:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO] --- maven-archetype-plugin:3.0.1:generate (default-cli) @ standalone-pom---
[INFO] Generating project in Batch mode
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: basedir, Value: C:\fyicenter
[INFO] Parameter: package, Value: com.fyicenter
[INFO] Parameter: groupId, Value: com.fyicenter
[INFO] Parameter: artifactId, Value: hello
[INFO] Parameter: packageName, Value: com.fyicenter
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] project created from Old (1.x) Archetype in dir: C:\fyicenter\hello
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:05 min
[INFO] ------------------------------------------------------------------------

C:\fyicenter>tree /f hello

|   pom.xml
    |   |---java
    |       |---com
    |           |---fyicenter
    |                   App.java
C:\fyicenter>type hello\src\main\java\com\fyicenter\App.java

package com.fyicenter;

 * Hello world!
public class App
    public static void main( String[] args )
        System.out.println( "Hello World!" );


"mvn package" - Compile Maven Project

"mvn -h" - List Maven Commands and Options

Using Apache Maven

⇑⇑ FAQ for Apache Maven

2020-10-20, 1082🔥, 0💬