Avoiding repetitive groupIds and versions, and inheriting from the parent POM
In a multimodule Maven project, most of the modules (if not all) share the same groupId
and the version
elements. In that case, you can avoid adding version
and groupId
elements to your application POM file, as those will be automatically inherited from the corresponding parent POM.
If you look at
axis2-kernel
(which is a module of the Apache Axis2 project), you will find that no groupId
or a version
element is defined: (http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/kernel/pom.xml). Maven reads them from the parent POM file:
<project> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.axis2</groupId> <artifactId>axis2-parent</artifactId> <version>1.7.0-SNAPSHOT</version> <relativePath>../parent/pom.xml</relativePath> </parent> <artifactId>axis2-kernel...