Once I had been using ant, and then I heard about Maven. But what am I supposed to think about Maven.
To use maven, we first need to create the basic skeleton of the content of the project. This is performed using in the parent directory of the future project directory:
$ mvn archetype:create -DgroupId=org.jaycode.jdream -DartifactId=jdream
We can now enter the project directory:
$ cd jdream
It creates diverse files and directories, in particular a pom.xml, which is a file describing the project and
main application and test files.
From there we can start coding. But a number of task can be performed (here an extract from the maven tutorial):
- validate : validate the project is correct and all necessary information is available
- compile : compile the source code of the project
- test : test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
- package : take the compiled code and package it in its distributable format, such as a JAR.
- integration-test : process and deploy the package if necessary into an environment where integration tests can be run
- verify : run any checks to verify the package is valid and meets quality criteria
- install : install the package into the local repository, for use as a dependency in other projects locally
- deploy : done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
Another interesting feature is the possibility to adapt the pom file for eclipse:
$ mvn eclipse:eclipse
which creates the .classpath and .project files necessary for an eclipse project.
One of the very interesting feature of maven is the possibility of creating template projects to simplify the creation of whole projects. It allows for example the possibility to go in the direction of rails some how.