GeoTools 34 introduces the Bill of Materials (BOM) pattern to improve dependency management. This guide explains how to use the BOMs in your projects.
A BOM (Bill of Materials) is a special POM file that manages dependency versions across a project. Rather than specifying versions for each dependency individually, you can import the BOM which provides consistent versioning.
GeoTools provides two BOMs:
gt-platform-dependencies- Third-party dependency versionsgt-bom- GeoTools module versions (also imports platform-dependencies)
When developing GeoTools modules, you don't need to specify versions for internal dependencies:
<dependencies>
<!-- No version needed for GeoTools modules -->
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-main</artifactId>
</dependency>
<!-- No version needed for third-party dependencies declared in platform-dependencies -->
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
</dependency>
</dependencies>Applications using GeoTools should import the gt-bom in their dependency management:
<dependencyManagement>
<dependencies>
<!-- Import GeoTools BOM -->
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-bom</artifactId>
<version>34.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- No version needed for GeoTools modules -->
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
</dependency>
<!-- Other dependencies still need versions -->
<dependency>
<groupId>com.example</groupId>
<artifactId>my-library</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>When using Spring Framework, you can combine GeoTools BOM with Spring Framework's BOM:
<dependencyManagement>
<dependencies>
<!-- Spring Framework BOM -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>5.3.39</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- GeoTools BOM -->
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-bom</artifactId>
<version>34.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>The BOM also manages test artifacts, which use the tests classifier:
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-main</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>In some cases, you might want to use only the platform dependencies BOM:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-platform-dependencies</artifactId>
<version>34.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>If you need to override a specific dependency version:
<dependencyManagement>
<dependencies>
<!-- Import GeoTools BOM -->
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-bom</artifactId>
<version>34.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Override a specific dependency -->
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>1.19.0</version>
</dependency>
</dependencies>
</dependencyManagement>Using the GeoTools BOM offers several advantages:
- Simplified dependency management: No need to specify versions for each GeoTools module
- Version consistency: All GeoTools modules use compatible versions
- Easier upgrades: Change one version number instead of dozens
- Reduced transitive dependency conflicts: The BOM ensures compatible dependencies
- Industry standard approach: Following Maven best practices
If you see an error like:
'dependencies.dependency.version' for org.geotools:gt-main:jar is missing
It means you haven't properly imported the BOM in your dependencyManagement section.
If you see version conflicts, check if you're:
- Importing the BOM correctly with
<scope>import</scope>and<type>pom</type> - Not overriding versions unintentionally
- Using compatible versions of BOMs if importing multiple