| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <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> |
| <parent> |
| <groupId>org.apache.cassandra</groupId> |
| <artifactId>java-driver-parent</artifactId> |
| <version>4.19.3-SNAPSHOT</version> |
| </parent> |
| <artifactId>java-driver-core-shaded</artifactId> |
| <name>Apache Cassandra Java Driver - core with shaded deps</name> |
| <dependencyManagement> |
| <dependencies> |
| <dependency> |
| <groupId>${project.groupId}</groupId> |
| <artifactId>java-driver-bom</artifactId> |
| <version>${project.version}</version> |
| <type>pom</type> |
| <scope>import</scope> |
| </dependency> |
| </dependencies> |
| </dependencyManagement> |
| <dependencies> |
| <!-- |
| Declare a dependency to the core driver itself so that all its classes get included; |
| this dependency will be removed from the final pom by the shade plugin. |
| --> |
| <dependency> |
| <groupId>org.apache.cassandra</groupId> |
| <artifactId>java-driver-core</artifactId> |
| </dependency> |
| <!-- |
| Repeat all dependencies of the core driver *except* the ones that are going to be shaded, |
| so that they get included in the final pom (we don't use the "promoteTransitiveDependencies" |
| option of the shade plugin because it promotes all dependencies, even nested ones, to top level). |
| --> |
| <dependency> |
| <groupId>com.datastax.oss</groupId> |
| <artifactId>native-protocol</artifactId> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.cassandra</groupId> |
| <artifactId>java-driver-guava-shaded</artifactId> |
| </dependency> |
| <dependency> |
| <groupId>com.typesafe</groupId> |
| <artifactId>config</artifactId> |
| </dependency> |
| <dependency> |
| <groupId>com.github.jnr</groupId> |
| <artifactId>jnr-posix</artifactId> |
| </dependency> |
| <dependency> |
| <groupId>org.xerial.snappy</groupId> |
| <artifactId>snappy-java</artifactId> |
| <optional>true</optional> |
| </dependency> |
| <dependency> |
| <groupId>at.yawk.lz4</groupId> |
| <artifactId>lz4-java</artifactId> |
| <optional>true</optional> |
| </dependency> |
| <dependency> |
| <groupId>org.slf4j</groupId> |
| <artifactId>slf4j-api</artifactId> |
| </dependency> |
| <dependency> |
| <groupId>io.dropwizard.metrics</groupId> |
| <artifactId>metrics-core</artifactId> |
| </dependency> |
| <dependency> |
| <groupId>org.hdrhistogram</groupId> |
| <artifactId>HdrHistogram</artifactId> |
| </dependency> |
| <dependency> |
| <groupId>com.esri.geometry</groupId> |
| <artifactId>esri-geometry-api</artifactId> |
| <optional>true</optional> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.tinkerpop</groupId> |
| <artifactId>gremlin-core</artifactId> |
| <optional>true</optional> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.tinkerpop</groupId> |
| <artifactId>tinkergraph-gremlin</artifactId> |
| <optional>true</optional> |
| </dependency> |
| <dependency> |
| <groupId>org.reactivestreams</groupId> |
| <artifactId>reactive-streams</artifactId> |
| </dependency> |
| <dependency> |
| <groupId>com.github.stephenc.jcip</groupId> |
| <artifactId>jcip-annotations</artifactId> |
| <scope>provided</scope> |
| </dependency> |
| <dependency> |
| <groupId>com.github.spotbugs</groupId> |
| <artifactId>spotbugs-annotations</artifactId> |
| <scope>provided</scope> |
| </dependency> |
| </dependencies> |
| <!-- |
| Generation of the shaded driver-core bundle during package phase: |
| 1) shade plugin shades the driver and creates a shaded jar + source jar |
| 2) dependency plugin unpacks the shaded jar to target/classes (and removes unwanted content) |
| 3) bundle plugin analyzes shaded classes and generates the bundle manifest |
| 4) assembly plugin re-creates the shaded jar by packing target/classes + manifest + shaded pom |
| --> |
| <build> |
| <resources> |
| <resource> |
| <directory>src/main/resources</directory> |
| </resource> |
| <resource> |
| <directory>${project.basedir}/..</directory> |
| <includes> |
| <include>LICENSE</include> |
| <include>NOTICE_binary.txt</include> |
| <include>NOTICE.txt</include> |
| </includes> |
| <targetPath>META-INF</targetPath> |
| </resource> |
| </resources> |
| <plugins> |
| <plugin> |
| <artifactId>maven-shade-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>shade-core-dependencies</id> |
| <phase>package</phase> |
| <goals> |
| <goal>shade</goal> |
| </goals> |
| <configuration> |
| <createSourcesJar>true</createSourcesJar> |
| <shadeSourcesContent>true</shadeSourcesContent> |
| <artifactSet> |
| <includes> |
| <!-- |
| Include: |
| - The core driver itself; it is not relocated but needs to be included. |
| - All the dependencies we want to shade & relocate. |
| --> |
| <include>org.apache.cassandra:java-driver-core</include> |
| <include>io.netty:*</include> |
| <include>com.fasterxml.jackson.core:*</include> |
| </includes> |
| </artifactSet> |
| <relocations> |
| <!-- |
| Check if relocations declared here must also be declared below to operate on |
| GraalVM's reflection.json file. Currently this is required for Netty only. |
| --> |
| <relocation> |
| <pattern>io.netty</pattern> |
| <shadedPattern>com.datastax.oss.driver.shaded.netty</shadedPattern> |
| </relocation> |
| <relocation> |
| <pattern>com.fasterxml.jackson</pattern> |
| <shadedPattern>com.datastax.oss.driver.shaded.fasterxml.jackson</shadedPattern> |
| </relocation> |
| </relocations> |
| <filters> |
| <!-- Exclude everything under META-INF --> |
| <filter> |
| <artifact>org.apache.cassandra:*</artifact> |
| <excludes> |
| <!-- Don't exclude META-INF/services and META-INF/native-image --> |
| <exclude>META-INF/MANIFEST.MF</exclude> |
| <exclude>META-INF/maven/**</exclude> |
| </excludes> |
| </filter> |
| <filter> |
| <artifact>io.netty:*</artifact> |
| <excludes> |
| <exclude>META-INF/**</exclude> |
| </excludes> |
| </filter> |
| <filter> |
| <artifact>com.fasterxml.jackson.core:*</artifact> |
| <excludes> |
| <exclude>META-INF/**</exclude> |
| </excludes> |
| </filter> |
| </filters> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| <plugin> |
| <artifactId>maven-dependency-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>unpack-shaded-classes</id> |
| <phase>package</phase> |
| <goals> |
| <goal>unpack</goal> |
| </goals> |
| <configuration> |
| <artifactItems> |
| <artifactItem> |
| <groupId>org.apache.cassandra</groupId> |
| <artifactId>java-driver-core-shaded</artifactId> |
| <type>jar</type> |
| <outputDirectory>${project.build.outputDirectory}</outputDirectory> |
| </artifactItem> |
| </artifactItems> |
| </configuration> |
| </execution> |
| <!-- Unpack shaded sources in order to run javadoc on them: --> |
| <execution> |
| <id>unpack-shaded-sources</id> |
| <phase>package</phase> |
| <goals> |
| <goal>unpack</goal> |
| </goals> |
| <configuration> |
| <artifactItems> |
| <artifactItem> |
| <groupId>org.apache.cassandra</groupId> |
| <artifactId>java-driver-core-shaded</artifactId> |
| <type>jar</type> |
| <classifier>sources</classifier> |
| <outputDirectory>${project.build.directory}/shaded-sources</outputDirectory> |
| </artifactItem> |
| </artifactItems> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| <!-- Apply shading to classes declared in GraalVM reflection.json config file --> |
| <plugin> |
| <groupId>com.google.code.maven-replacer-plugin</groupId> |
| <artifactId>replacer</artifactId> |
| <version>1.5.3</version> |
| <executions> |
| <execution> |
| <id>shade-graalvm-files</id> |
| <phase>package</phase> |
| <goals> |
| <goal>replace</goal> |
| </goals> |
| </execution> |
| </executions> |
| <configuration> |
| <ignoreMissingFile>false</ignoreMissingFile> |
| <filesToInclude>${project.build.directory}/classes/META-INF/native-image/com.datastax.oss/java-driver-core/reflection.json,${project.build.directory}/shaded-sources/META-INF/native-image/com.datastax.oss/java-driver-core/reflection.json</filesToInclude> |
| <replacements> |
| <replacement> |
| <token>io.netty</token> |
| <value>com.datastax.oss.driver.shaded.netty</value> |
| </replacement> |
| </replacements> |
| </configuration> |
| </plugin> |
| <plugin> |
| <groupId>org.apache.felix</groupId> |
| <artifactId>maven-bundle-plugin</artifactId> |
| <extensions>true</extensions> |
| <executions> |
| <execution> |
| <id>generate-shaded-manifest</id> |
| <phase>package</phase> |
| <goals> |
| <goal>manifest</goal> |
| </goals> |
| <configuration> |
| <instructions> |
| <Automatic-Module-Name>com.datastax.oss.driver.core</Automatic-Module-Name> |
| <Bundle-SymbolicName>com.datastax.oss.driver.core</Bundle-SymbolicName> |
| <!-- |
| Allow importing code from other packages |
| (so reflection-based loading of policies works) |
| --> |
| <DynamicImport-Package>*</DynamicImport-Package> |
| <Import-Package> |
| <!-- |
| 1) Don't import packages shaded in the driver bundle. Note that shaded-guava lives |
| in its own bundle, so we must explicitly *not* mention it here. |
| -->!com.datastax.oss.driver.shaded.netty.*, !com.datastax.oss.driver.shaded.fasterxml.jackson.*, |
| <!-- |
| 2) Don't include the packages below because they contain annotations only and are |
| not required at runtime. |
| -->!net.jcip.annotations.*, !edu.umd.cs.findbugs.annotations.*, |
| <!-- |
| 3) Don't include GraalVM. |
| -->!org.graalvm.*, !com.oracle.svm.*, |
| <!-- |
| 4) Use resolution:=optional whenever possible in order to make it possible to use |
| the OSS driver without such dependencies in an OSGi environment, as long as the |
| application does not attempt to access their packages. |
| Note: dependencies marked as optional are by default included with optional |
| resolution in the manifest; we only need to manually set the resolution to |
| optional for dependencies declared as non-optional in the pom files. |
| -->jnr.*;resolution:=optional, com.esri.core.geometry.*;resolution:=optional,org.reactivestreams.*;resolution:=optional, org.apache.tinkerpop.*;resolution:=optional, org.javatuples.*;resolution:=optional, reactor.blockhound.*;resolution:=optional, |
| <!-- |
| 5) Don't import packages imported by shaded classes, if they are not used by the |
| driver bundle. |
| -->!com.google.protobuf.*, !com.jcraft.jzlib.*, !com.ning.compress.*, !lzma.sdk.*, !net.jpountz.xxhash.*, !org.bouncycastle.*, !org.conscrypt.*, !org.apache.commons.logging.*, !org.apache.log4j.*, !org.apache.logging.log4j.*, !org.eclipse.jetty.*, !org.jboss.marshalling.*, !sun.misc.*, !sun.security.*, !com.barchart.udt.*, !com.fasterxml.aalto.*, !com.sun.nio.sctp.*, !gnu.io.*, !org.xml.sax.*, !org.w3c.dom.*, !com.aayushatharva.brotli4j.*, !com.github.luben.zstd.*, * |
| </Import-Package> |
| <!-- |
| Export: |
| 1) The driver's packages (API and internal); |
| 2) All shaded packages, except Guava which resides in a separate bundle. |
| --> |
| <Export-Package>com.datastax.oss.driver.api.core.*, com.datastax.oss.driver.internal.core.*, com.datastax.dse.driver.api.core.*, com.datastax.dse.driver.internal.core.*, com.datastax.oss.driver.shaded.netty.*, com.datastax.oss.driver.shaded.fasterxml.jackson.*,</Export-Package> |
| </instructions> |
| <rebuildBundle>true</rebuildBundle> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| <plugin> |
| <artifactId>maven-assembly-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>generate-final-shaded-jar</id> |
| <phase>package</phase> |
| <goals> |
| <goal>single</goal> |
| </goals> |
| <configuration> |
| <archive> |
| <!-- this is the manifest generated by the bundle plugin --> |
| <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> |
| </archive> |
| <descriptors> |
| <descriptor>src/assembly/shaded-jar.xml</descriptor> |
| </descriptors> |
| <!-- Replace the original artifact --> |
| <appendAssemblyId>false</appendAssemblyId> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| <plugin> |
| <groupId>org.revapi</groupId> |
| <artifactId>revapi-maven-plugin</artifactId> |
| <configuration> |
| <skip>true</skip> |
| </configuration> |
| </plugin> |
| </plugins> |
| </build> |
| </project> |