Don't bundle all netty dependencies into netty-all (#11202)

Motivation:

netty-all already depends on the other netty-* packages so there's no need to also bundle them.

The duplicated classes cause classpath issues, particularly with Java > 8, which reports errors like this:
The package io.netty.buffer is accessible from more than one module: io.netty.all, io.netty.buffer

Modifications:

- Removed bundling tasks from netty-all's maven pom.xml

Result:

- netty-all no longer bundles all classes. Instead, classes are provided by expressed dependencies.

Fixes #4671
This commit is contained in:
Craig Andrews 2021-05-03 09:53:03 -04:00 committed by GitHub
parent 6b3ec62e6e
commit 612ab58448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,28 +66,24 @@
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-aarch_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<classifier>osx-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<classifier>osx-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
@ -102,28 +98,24 @@
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-aarch_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<classifier>osx-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<classifier>osx-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
@ -146,20 +138,17 @@
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- Just include the classes for the other platform so these are at least present in the netty-all artifact -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
@ -181,7 +170,6 @@
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
@ -189,14 +177,12 @@
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- Just include the classes for the other platform so these are at least present in the netty-all artifact -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
@ -216,20 +202,17 @@
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- Just include the classes for the other platform so these are at least present in the netty-all artifact -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
@ -249,20 +232,17 @@
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- Just include the classes for the other platform so these are at least present in the netty-all artifact -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
@ -390,405 +370,117 @@
<groupId>${project.groupId}</groupId>
<artifactId>netty-buffer</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-dns</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-haproxy</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-http</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-http2</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-memcache</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-mqtt</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-redis</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-smtp</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-socks</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-stomp</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-xml</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-common</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-handler</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-handler-proxy</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver-dns</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-rxtx</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-sctp</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-udt</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-example</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- Add optional dependencies explicitly to avoid Javadoc warnings and errors. -->
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>clean-first</id>
<phase>generate-resources</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<!-- Populate the properties whose key is groupId:artifactId:type
and whose value is the path to the artifact -->
<execution>
<id>locate-dependencies</id>
<phase>initialize</phase>
<goals>
<goal>properties</goal>
</goals>
</execution>
<!-- Unpack all source files -->
<execution>
<id>unpack-sources</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<includes>io/netty/**</includes>
<includeScope>runtime</includeScope>
<includeGroupIds>${project.groupId}</includeGroupIds>
<outputDirectory>${generatedSourceDir}</outputDirectory>
</configuration>
</execution>
<!-- Unpack all class files -->
<execution>
<id>unpack-jars</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludes>io/netty/internal/tcnative/**,io/netty/example/**,META-INF/native/libnetty_tcnative*,META-INF/native/include/**,META-INF/native/**/*.a</excludes>
<includes>io/netty/**,META-INF/native/**,META-INF/native-image/**</includes>
<includeScope>runtime</includeScope>
<includeGroupIds>${project.groupId}</includeGroupIds>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<!-- Instead of generating a new version property file, merge others' version property files into one. -->
<execution>
<id>write-version-properties</id>
<phase>none</phase>
</execution>
<execution>
<id>merge-version-properties</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<propertyselector property="versions" match="^(${project.groupId}:(?!netty-example)[^:]+:jar(?::[^:]+)?)$" select="\1" />
<for list="${versions}" param="x">
<sequential>
<unzip src="${@{x}}" dest="${dependencyVersionsDir}">
<patternset>
<include name="META-INF/${project.groupId}.versions.properties" />
</patternset>
</unzip>
<concat destfile="${project.build.outputDirectory}/META-INF/${project.groupId}.versions.properties" append="true">
<path path="${dependencyVersionsDir}/META-INF/${project.groupId}.versions.properties" />
</concat>
</sequential>
</for>
<delete dir="${dependencyVersionsDir}" quiet="true" />
</target>
</configuration>
</execution>
<!-- Clean everything once finished so that IDE doesn't find the unpacked files. -->
<execution>
<id>clean-source-directory</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete dir="${generatedSourceDir}" quiet="true" />
<delete dir="${dependencyVersionsDir}" quiet="true" />
<delete dir="${project.build.outputDirectory}" quiet="true" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<!-- Include the directory where the source files were unpacked -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>prepare-package</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${generatedSourceDir}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Disable OSGi bundle manifest generation -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>generate-manifest</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<!-- Override the default JAR configuration -->
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>none</phase>
</execution>
<execution>
<id>all-in-one-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Automatic-Module-Name>io.netty.all</Automatic-Module-Name>
</manifestEntries>
<index>true</index>
</archive>
</configuration>
</execution>
</executions>
</plugin>
<!-- Disable animal sniffer -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<executions>
<execution>
<id>default</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<!-- Disable checkstyle -->
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<id>check-style</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<!-- Disable all plugin executions configured by jar packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>default-resources</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testResources</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>