Skip to content

Commit 4413334

Browse files
committed
Use multi release jar to move the Jackson v3 implementation in vertx-core.
1 parent 722eb2d commit 4413334

File tree

7 files changed

+67
-28
lines changed

7 files changed

+67
-28
lines changed

vertx-core-jackson-v3/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<name>Vert.x Core Jackson v3 plugin</name>
2727

2828
<properties>
29-
<maven.compiler.release>17</maven.compiler.release>
29+
<maven.compiler.release>25</maven.compiler.release>
3030
</properties>
3131

3232
<dependencies>

vertx-core-jackson-v3/src/main/java/io/vertx/core/jacksonv3/JacksonFactory.java

Lines changed: 0 additions & 12 deletions
This file was deleted.

vertx-core-jackson-v3/src/main/java/module-info.java

Lines changed: 0 additions & 12 deletions
This file was deleted.

vertx-core-jackson-v3/src/test/java/io/vertx/tests/jacksonv3/JsonTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.vertx.tests.jacksonv3;
22

3-
import io.vertx.core.jacksonv3.JacksonCodec;
43
import io.vertx.core.json.Json;
54
import io.vertx.core.json.JsonObject;
65
import org.junit.Test;
@@ -21,7 +20,7 @@ public void testNoJacksonV2() {
2120

2221
@Test
2322
public void testFactory() {
24-
assertEquals(JacksonCodec.class, Json.CODEC.getClass());
23+
assertEquals("io.vertx.core.json.jackson.v3.JacksonCodec", Json.CODEC.getClass().getName());
2524
}
2625

2726
@Test

vertx-core/pom.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@
127127
<artifactId>jackson-databind</artifactId>
128128
<optional>true</optional>
129129
</dependency>
130+
<dependency>
131+
<groupId>tools.jackson.core</groupId>
132+
<artifactId>jackson-core</artifactId>
133+
<version>3.0.0-rc1</version>
134+
<optional>true</optional>
135+
</dependency>
130136

131137
<!-- Loggers -->
132138
<dependency>
@@ -245,6 +251,19 @@
245251
</annotationProcessorPaths>
246252
</configuration>
247253
</execution>
254+
<execution>
255+
<id>jdk25</id>
256+
<goals>
257+
<goal>compile</goal>
258+
</goals>
259+
<configuration>
260+
<release>25</release>
261+
<compileSourceRoots>
262+
<compileSourceRoot>${project.basedir}/src/main/java25</compileSourceRoot>
263+
</compileSourceRoots>
264+
<multiReleaseOutput>true</multiReleaseOutput>
265+
</configuration>
266+
</execution>
248267
</executions>
249268
</plugin>
250269

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (c) 2011-2019 Contributors to the Eclipse Foundation
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License 2.0 which is available at
6+
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
7+
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
8+
*
9+
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
10+
*/
11+
12+
package io.vertx.core.json.jackson;
13+
14+
import io.vertx.core.spi.json.JsonCodec;
15+
16+
/**
17+
* @author <a href="mailto:[email protected]">Julien Viet</a>
18+
*/
19+
public class JacksonFactory implements io.vertx.core.spi.JsonFactory {
20+
21+
public static final JacksonFactory INSTANCE = new JacksonFactory();
22+
23+
public static final JsonCodec CODEC;
24+
25+
static {
26+
JsonCodec codec;
27+
try {
28+
codec = new io.vertx.core.json.jackson.v3.JacksonCodec();
29+
} catch (Throwable ignore1) {
30+
// Not available
31+
try {
32+
codec = new DatabindCodec();
33+
} catch (Throwable ignore2) {
34+
// No databind
35+
codec = new JacksonCodec();
36+
}
37+
}
38+
CODEC = codec;
39+
}
40+
41+
@Override
42+
public JsonCodec codec() {
43+
return CODEC;
44+
}
45+
}

vertx-core-jackson-v3/src/main/java/io/vertx/core/jacksonv3/JacksonCodec.java renamed to vertx-core/src/main/java25/io/vertx/core/json/jackson/v3/JacksonCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.vertx.core.jacksonv3;
1+
package io.vertx.core.json.jackson.v3;
22

33
import io.vertx.core.buffer.Buffer;
44
import io.vertx.core.json.DecodeException;

0 commit comments

Comments
 (0)