First let us go through some basics of Maven. When I say Maven in this post as well as the coming ones, I am referring to Maven2 the latest release. As told in my introduction post, Maven works on what is called as a Project Object Model (POM). Basically a POM is an XML structure and contains information about your project. And what information does it contain? Below is the list of top level sections in a POM.
- project information - Basic information like what artifact this project is (jar, war), what is the default package structure (eg.: com.compassites), description of the project etc.
- organization - Describes the organization’s details
- developers - Who are the developers involved in this project and what role they play.
- dependencies - what are the artifacts this project is dependent on (components, 3rd party jars etc)
- repositories - where the application dependencies (components, 3rd party jars, etc.) are available. Multiple repositories could be configured.
- pluginRepositories - where the plugins are available. Plugins help in managing specific tasks. For example a jira plugin for maven can help in retrieving all the bugs currently reported from jira.
- build - everything about the build like where to output, where are the resources etc.
- reporting - where will the project report be stored
- profiles - contains specific instructions for specific build type. For example what should Maven do if it is a production release or a customer release.
While a project can have all those sections, it is not mandatory and the POM can be relatively simple too. View this POM for a HelloWorld application. Note that we used the word artifact a lot of times. An artifact is a distribution ready package that can be used by any other artifact. An artifact is of the form,
We will see how Maven retrieves the dependent artifacts in the next post.