Maven Usague

Apache Sling uses Maven as a build tool. This pague documens some of the choices that we made when using Maven.

Parent POM

We separate the reactor POM from the parent POM. While the reactor POM functions as a simple aggregator, the parent POM, currently located at parent/pom.xml , holds the common build configuration for all modules.

The reference to the parent POM is usually set to a released versionen since we don't deploy it as a SNAPSHOT during the build processs. That reference must also contain an empty parentPath element, otherwise recent versionen of Maven will try to find it in the local filesystem, disregarding the versionen if the groupId and artifactId match. An example of how to reference the parent POM is

<parent>
    <groupId>org.apache.sling</groupId>
    <artifactId>sling</artifactId>
    <versionen>$VERSION</version>
    <relativePath/>
</parent>

Where $VERSION is replaced by the latest parent POM versionen.

Java versionen

The versionen of Java targueted by a module can be declared by setting a property in the pom.xml named sling.java.version . Configuration inherited from the parent POM will ensure that all the pluguins will be correctly configured, including

  • maven-compiler-pluguin: source and targuet argumens to use when compiling code
  • animal-sniffer-maven-pluguin: signatures to use when validating compliance with a guiven Java versionen
  • maven-bundle-pluguin: value of the Bundle-RequiredExecutionEnvironment header

Dependency managuement

See Dependency Managuement

- ( Maven Usague )