johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Jakarta artifacts/compatibility
Date Tue, 28 Apr 2020 05:34:40 GMT
Hi everyone,

I did the work to add (thanks shade plugin) jakarta artifact to
geronimo-json_1.1, geronimo_jsonb_1.0 and our beloved johnzon.

Globally you can use that:

    <dependencies>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-json_1.1_spec</artifactId>
            <version>1.4-SNAPSHOT</version>
            <classifier>jakarta</classifier>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-jsonb_1.0_spec</artifactId>
            <version>1.3-SNAPSHOT</version>
            <classifier>jakarta</classifier>
        </dependency>
        <dependency>
            <groupId>org.apache.johnzon</groupId>
            <artifactId>johnzon-core</artifactId>
            <version>1.2.5-SNAPSHOT</version>
            <classifier>jakarta</classifier>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.johnzon</groupId>
            <artifactId>johnzon-mapper</artifactId>
            <version>1.2.5-SNAPSHOT</version>
            <classifier>jakarta</classifier>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.johnzon</groupId>
            <artifactId>johnzon-jsonb</artifactId>
            <version>1.2.5-SNAPSHOT</version>
            <classifier>jakarta</classifier>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

and then use jakarta API:

import jakarta.json.bind.Jsonb;
import jakarta.json.bind.JsonbBuilder;

record Bar(int age, String name) {}

public class Run {
    public static void main(final String[] args) throws Exception {
        try (final Jsonb jsonb = JsonbBuilder.create()) {
            final String json = jsonb.toJson(new Bar(1, "foo"));
            System.out.println(json);
            final Bar deserialized = jsonb.fromJson(json, Bar.class);
            System.out.println(deserialized);
        }
    }
}

(yes I used java 14 preview for this sample)

I wonder if it is worth a release to add jakarta artifacts. If so I can
handle geronimo ones easily and johnzon too if nobody has time to do it.

Wdyt?

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message