Created
November 27, 2013 01:34
-
-
Save mbedward/7669318 to your computer and use it in GitHub Desktop.
An example of how to safely combine GeoTools component jars into a single (uber) jar. It uses the Maven shade plugin to properly combine the META-INF/services entries of the individual GeoTools jars.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>org.geotools</groupId> | |
<artifactId>gt-uber</artifactId> | |
<!-- The version of the GeoTools jars to combine --> | |
<version>10.2</version> | |
<packaging>jar</packaging> | |
<name>Combined GeoTools jar</name> | |
<description> | |
Creates a single jar containing all GeoTools modules required by | |
your project. You can then reference this jar from your project pom.xml | |
rather than individual GeoTools jars. | |
</description> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-shade-plugin</artifactId> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<goals> | |
<goal>shade</goal> | |
</goals> | |
<configuration> | |
<artifactSet> | |
<!-- --> | |
<!-- We only want to include GeoTools dependencies and not the --> | |
<!-- large number of third party transitive dependencies --> | |
<!-- --> | |
<includes> | |
<include>org.geotools:gt-*</include> | |
</includes> | |
</artifactSet> | |
<transformers> | |
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/> | |
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> | |
<resource>META-INF/registryFile.jai</resource> | |
</transformer> | |
</transformers> | |
<createSourcesJar>true</createSourcesJar> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
<dependencies> | |
<!-- --> | |
<!-- GeoTools modules to include in the uber-jar --> | |
<!-- (other moduels which are transitive dependencies --> | |
<!-- will also be pulled in) --> | |
<!-- --> | |
<dependency> | |
<groupId>${project.groupId}</groupId> | |
<artifactId>gt-shapefile</artifactId> | |
<version>${project.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>${project.groupId}</groupId> | |
<artifactId>gt-swing</artifactId> | |
<version>${project.version}</version> | |
</dependency> | |
<dependency> | |
<groupId>${project.groupId}</groupId> | |
<artifactId>gt-epsg-hsql</artifactId> | |
<version>${project.version}</version> | |
</dependency> | |
</dependencies> | |
</project> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment