POM (groupId:artifactId:versi on)
by, 11-07-2011 at 06:22 PM (2015 Views)
A project object model (POM.xml) contains all necessary information about a project like configurations of plugins involved. You might be thinking about Ant build file. You may embed ant tasks inside the POM. A build.xml tells Ant precisely what to do when it is run, a POM states its configuration.
A POM in simplest form is given below:
Let me explain the used tags and their purpose. First of all, do note that the given POM.xml is the minimum that Maven 2 will allow. The fields groupId, artifactId, version are all required fields. These fields act much like an address and timestamp and marks a specific place in a repository.
The field groupId is unique amongst an organization/project. Itís a common practice to use dot notation in groupId. Its not a must and you may use dash notation or what ever you like. If you plan to use the dot notation, remember that this does not have to correspond to the package structure that the project contains. The group acts like the Java packaging structure (in an operating system) when stored in the repository. In the given POM, org.codehaus.mojo group lives within the directory $M2_REPO/org/codehaus/mojo .
The name of the project is given by artifactId generally. There may live many projects under the same group. The artifactID along with the groupId, create a key that separates this project from every other project in the world. In the discussed example, my-project lives in $M2_REPO/org/codehaus/mojo/my-project .
The groupId:artifactId combination denotes a single project but they cannot define which particular version of that project we are talking about. In software world, we have version numbers to differentiate the versions. Version no is used within an artifact's repository to separate versions from each other. my-project version 1.0 files will reside at: $M2_REPO/org/codehaus/mojo/my-project/1.0 .