Friday, November 19, 2010

Generating project structure using Maven

To generate the project structure using maven, we use maven's archetype mechanism. In Maven, an archetype is a template of a project which is combined with some user input to produce a working Maven project that has been tailored to the user's requirements (This help you generate the desired project structure depending on the application that you are trying to build.)


Following I have shown how you can use maven to generate a project structure for simple java application.


mvn archetype:create -DgroupId=org.wso2.carbon -DartifactId=sample -DarchetypeArtifactId=maven-archetype-quickstart


This will generate a project structure as follows



|-- sample
|   |-- pom.xml
|   `-- src
|       |-- main
|       |   `-- java
|       |       `-- org
|       |           `-- wso2
|       |               `-- carbon
|       |                   `-- App.java
|       `-- test
|           `-- java
|               `-- org
|                   `-- wso2
|                       `-- carbon
|                           `-- AppTest.java



This will create App.java with package name as org.wso2.carbon and create default pom.xml as well as AppTest.java class for unit testing.

2 comments:

zygimantus said...

You need to use mvn archetype:generate -DgroupId=org.wso2.carbon -DartifactId=sample -DarchetypeArtifactId=maven-archetype-quickstart (generate instead of create). NOTE: Apache Maven 3.3.3

JacobHarman said...

The IT area of Lithuania is blasting reliably with significant development achievements in FinTech, portable application advancement, and cryptographic money spaces. A little Baltic condition of around 2.8 million individuals with €45.1 billion Gross domestic product has demonstrated as a focal point of development, ground breaking, and a splendid spot for FinTech and IT new businesses.

Fueled by the hearty ICT foundation, minimal expense web, and educated labor supply, Lithuania has arisen as another center point for FinTech and programming improvement arrangements. FinTech organizations developed by over 40% year over year in 2018>> Mobilunity