Project Object Model (POM) Files¶
Complete documentation for the project XML file for Maven can be found at the Maven site, and in particular in the project descriptor part of the reference section.
We only show the things specific to a GeoTools module pom.xml
file here.
Extending a Parent Module¶
The <parent> section allows one pom.xml
file to inherit items from another. Modules should extend the pom.xml
within the module, plugin, extension or demo directory they belong to:
<parent>
<groupId>org.geotools</groupId>
<artifactId>gt-module</artifactId>
<version>2.2-SNAPSHOT</version>
</Parent>
Artifact Id and GroupId¶
The combination of id and groupId uniquely identifies each artifact in a maven build.
The id should reflect the name of the module.
We use a “gt” prefix to avoid conflicts (as the groupId
org.geotools
does not appear in the final JAR filenames).
Examples:
gt-main
gt-referencing.
This policy allows our gt-main.jar
to avoid conflict with an application main.jar
created that makes use of GeoTools.
The groupId is initially based reverse domain name org.geotools (following Java package name rules). GeoTools is a multi-module build with each submodule appending to the parent’s groupId.
Examples:
org.geotools
org.geotools.plugin
org.geotools.extension
Dependencies¶
Dependencies are specified within the pom.xml
file, but care is required to handle this in a consistent manner.
New dependencies on another GeoTools module, should use:
groupId
- identify the projectartifactId
- identify the jar within that projectversion
-${project.version}
to match the current build
Sample pom.xml
dependency entry:
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-main</artifactId>
<version>${project.version}</version>
</Dependency>
Dependencies on a third-party jar are defined in two parts.
First the dependency is supplied in the pom.xml
file:
<dependencies>
...
<dependency>
<groupId>org.postgis</groupId>
<artifactId>postgis-driver</artifactId>
<!-- The version number is specified in the parent POM. -->
</dependency>
...
</dependencies>
Second the dependency version is supplied in the “root” pom.xml
file in the dependency management section:
<dependencyManagement>
...
<dependency>
<groupId>org.postgis</groupId>
<artifactId>postgis-driver</artifactId>
<version>1.0</version>
</dependency>
...
<dependencyManagement>
We make use of properties to update multi-module dependencies at the same time:
<properties>
<batik.version>1.17</batik.version>
<commons-beanutils.version>1.9.2</commons-beanutils.version>
<db2.jdbc.version>11.5.9.0</db2.jdbc.version>
<eclipse.emf.version>2.15.0</eclipse.emf.version>
<elasticsearch.version>7.14.0</elasticsearch.version>
<hamcrest.version>3.0</hamcrest.version>
<imageio.ext.version>1.4.13</imageio.ext.version>
<informix.jdbc.version>4.50.7.1</informix.jdbc.version>
<jackson2.version>2.17.2</jackson2.version>
<jackson2.databind.version>${jackson2.version}</jackson2.databind.version>
<jaiext.version>1.1.27</jaiext.version>
<javax.activation-api.version>1.2.0</javax.activation-api.version>
<jaxb.api.version>2.4.0-b180830.0359</jaxb.api.version>
<jaxb.runtime.version>2.4.0-b180830.0438</jaxb.runtime.version>
<jt.version>1.6.0</jt.version>
<jtds.jdbc.version>1.3.1</jtds.jdbc.version>
<jts.version>1.20.0</jts.version>
<log4j2.version>2.24.1</log4j2.version>
<logback.version>1.3.12</logback.version>
<mockito.version>5.12.0</mockito.version>
<mssql-jdbc.version>9.4.0.jre8</mssql-jdbc.version>
<mysql-connector-java.version>8.0.28</mysql-connector-java.version>
<netcdf.version>5.5.3</netcdf.version>
<ojdbc8.version>19.18.0.0</ojdbc8.version>
<postgresql.jdbc.version>42.7.3</postgresql.jdbc.version>
<reload4j.version>1.2.19</reload4j.version>
<sl4j.version>2.0.16</sl4j.version>
<solrj.version>8.11.3</solrj.version>
</properties>