Skip to content

Commit f1cc0ba

Browse files
committed
Upgrade and shade netty
Make driver depend on netty-handler instead of netty-all because it is much smaller and contains only features we use. Also netty version is upgraded from 4.1.15 to 4.1.16. Introduced shade plugin to pack netty dependency inside driver jar. Shaded classes will be relocated to `org.neo4j.driver.internal.shaded` package. This means driver will not bring netty as it's transitive dependency and has it's private copy of netty classes removing the possibility of dependency conflicts.
1 parent 914facf commit f1cc0ba

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ community/neo4j-harness/data
2525
community/server-plugin-test/neo4j-home
2626
enterprise/server-enterprise/neo4j-home
2727
integrationtests/data
28+
dependency-reduced-pom.xml

driver/pom.xml

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<build.revision></build.revision>
99
<bundle.name>${project.groupId}.${project.artifactId}</bundle.name>
1010
<maven.build.timestamp.format>'v'yyyyMMdd-HHmm</maven.build.timestamp.format>
11-
<netty.version>4.1.15.Final</netty.version>
11+
<netty.version>4.1.16.Final</netty.version>
1212
</properties>
1313

1414
<parent>
@@ -35,7 +35,7 @@
3535
<dependencies>
3636
<dependency>
3737
<groupId>io.netty</groupId>
38-
<artifactId>netty-all</artifactId>
38+
<artifactId>netty-handler</artifactId>
3939
<version>${netty.version}</version>
4040
</dependency>
4141

@@ -220,13 +220,22 @@
220220
<plugin>
221221
<groupId>org.apache.maven.plugins</groupId>
222222
<artifactId>maven-surefire-plugin</artifactId>
223-
<version>2.19.1</version>
223+
<version>2.20.1</version>
224224
</plugin>
225225
<plugin>
226226
<groupId>org.apache.maven.plugins</groupId>
227227
<artifactId>maven-failsafe-plugin</artifactId>
228-
<version>2.19</version>
228+
<version>2.20.1</version>
229229
<configuration>
230+
<!--
231+
Failsafe plugin starting from 2.19 by default runs tests from 'target/test-classes' against a package jar.
232+
When we shade things into the jar packages are changed, however tests in 'target/test-classes' do not.
233+
This results in AbstractMethodError and other kind of strange errors.
234+
235+
Following setting tells failsafe to run tests against 'target/classes' instead.
236+
See https://issues.apache.org/jira/browse/SUREFIRE-1198 for more details.
237+
-->
238+
<classesDirectory>${project.build.directory}/classes</classesDirectory>
230239
</configuration>
231240
<executions>
232241
<execution>
@@ -237,6 +246,33 @@
237246
</execution>
238247
</executions>
239248
</plugin>
249+
<plugin>
250+
<groupId>org.apache.maven.plugins</groupId>
251+
<artifactId>maven-shade-plugin</artifactId>
252+
<version>3.1.0</version>
253+
<executions>
254+
<execution>
255+
<phase>package</phase>
256+
<goals>
257+
<goal>shade</goal>
258+
</goals>
259+
<configuration>
260+
<artifactSet>
261+
<includes>
262+
<include>io.netty:*</include>
263+
</includes>
264+
</artifactSet>
265+
<relocations>
266+
<relocation>
267+
<pattern>io.netty</pattern>
268+
<shadedPattern>org.neo4j.driver.internal.shaded.io.netty</shadedPattern>
269+
</relocation>
270+
</relocations>
271+
<shadeTestJar>true</shadeTestJar>
272+
</configuration>
273+
</execution>
274+
</executions>
275+
</plugin>
240276
</plugins>
241277
</build>
242278

0 commit comments

Comments
 (0)