Find your content:

Search form

You are here

Learn MVN - How to create a Project?


Create a folder and start a shell in that directory and execute the below command. 

mvn archetype:generate -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false

It may take a while for the first run. This is because Maven is downloading the most recent jars and other files into your local repository. You may also need to execute the command a couple of time before it succeeds due to the remote server availability. Once it completes the process, you see the my-app folder created. Under this diectory you will notice the following standard project structure.

|-- pom.xml
`-- src
    |-- main
    |   `-- java
    |       `-- com
    |           `-- mycompany
    |               `-- app
    |                   `--
    `-- test
        `-- java
            `-- com
                `-- mycompany
                    `-- app


The src/main/java directory contains the project source code, the src/test/java directory contains the test source and the pom.xml. This file is the Project Object Model or POM.


My Block Status

My Block Content