in Maven, Tutorials

[Tutorial] Create, compile and test a project with Maven

Here is a first video tutorial about Maven, under DOS.
First i create a project based on the maven-archetype-quickstart archetype with the following command and arguments :

mvn archetype:generate 
-DgroupId=com.company.celinio 
-DartifactId=FirstTuto 
-DarchetypeArtifactId=maven-archetype-quickstart 
-DinteractiveMode=false


Archetypes are sort of templates of projects.
This command creates a folders structure and a basic Java class App.java that displays the classic “Hello World!”. It also creates a JUnit test class named AppTest.java .
The groupId corresponds to the name of the package
The artifactId corresponds to the name of the project.
Regarding the terminology, archetype is called a plugin and generate is called a goal.

Then i compile the project and run the test.

mvn compile
mvn test

The compiled classes are generated in the target folder.
Link to the video tutorial : http://www.celinio.net/tutorials/iframe.htm

More info : http://maven.apache.org/archetype/maven-archetype-plugin/usage.html