Skip to content

Commit

Permalink
Introduce JSON-B and JSON-P extensions
Browse files Browse the repository at this point in the history
I haven't added a FeatureBuildItem as I don't think they are worth an
item in the feature list at startup.

Fixes quarkusio#1480 and quarkusio#1482 and a few other issues in passing.
  • Loading branch information
gsmet committed Mar 15, 2019
1 parent 65961b0 commit 19092ac
Show file tree
Hide file tree
Showing 25 changed files with 419 additions and 31 deletions.
42 changes: 40 additions & 2 deletions bom/pom.xml
Expand Up @@ -142,6 +142,8 @@
<jprocesses.version>1.6.5</jprocesses.version>
<jboss-logmanager.version>1.0.2</jboss-logmanager.version>
<jetty.version>9.4.14.v20181114</jetty.version>
<yasson.version>1.0.3</yasson.version>
<jakarta.json.version>1.1.5</jakarta.json.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -195,6 +197,18 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsonb</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsonp</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-netty</artifactId>
Expand Down Expand Up @@ -1017,10 +1031,15 @@
<artifactId>microprofile-rest-client-api</artifactId>
<version>${microprofile-rest-client.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
<version>${yasson.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>${javax.json.version}</version>
<artifactId>jakarta.json</artifactId>
<version>${jakarta.json.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
Expand Down Expand Up @@ -1177,6 +1196,25 @@
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
</exclusion>
<exclusion>
<groupId>javax.json.bind</groupId>
<artifactId>javax.json.bind-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-json-p-provider</artifactId>
<version>${resteasy.version}</version>
<exclusions>
<exclusion>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down
23 changes: 23 additions & 0 deletions build-parent/pom.xml
Expand Up @@ -136,6 +136,26 @@
<artifactId>quarkus-jaxb-runtime</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsonb</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsonb-runtime</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsonp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsonp-runtime</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-netty</artifactId>
Expand Down Expand Up @@ -656,6 +676,9 @@
<exclude>org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec</exclude>
<!-- The API is packaged by the implementation-->
<exclude>javax.json:javax.json-api</exclude>
<!-- Use Jakarta -->
<exclude>org.glassfish:javax.json</exclude>
<exclude>javax.json.bind:javax.json.bind-api</exclude>
</excludes>
</bannedDependencies>
</rules>
Expand Down
20 changes: 20 additions & 0 deletions devtools/common/src/main/filtered/extensions.json
Expand Up @@ -126,6 +126,26 @@
"groupId": "io.quarkus",
"artifactId": "quarkus-jdbc-postgresql"
},
{
"name": "JSON-B",
"labels": [
"jsonb",
"json-b",
"json"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jsonb"
},
{
"name": "JSON-P",
"labels": [
"jsonp",
"json-p",
"json"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jsonp"
},
{
"name": "Kotlin",
"labels": [
Expand Down
48 changes: 48 additions & 0 deletions extensions/jsonb/deployment/pom.xml
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>quarkus-jsonb-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-jsonb</artifactId>
<name>Quarkus - JSON-B - Deployment</name>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsonp</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsonb-runtime</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>

</project>
@@ -0,0 +1,35 @@
/*
* Copyright 2019 Red Hat, Inc.
*
* Licensed 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.
*/
package io.quarkus.jsonb.deployment;

import org.eclipse.yasson.JsonBindingProvider;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.substrate.SubstrateResourceBundleBuildItem;

public class JsonbProcessor {

@BuildStep
void build(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
BuildProducer<SubstrateResourceBundleBuildItem> resourceBundle) {
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false,
JsonBindingProvider.class.getName()));

resourceBundle.produce(new SubstrateResourceBundleBuildItem("yasson-messages"));
}
}
20 changes: 20 additions & 0 deletions extensions/jsonb/pom.xml
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>quarkus-build-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../../build-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-jsonb-parent</artifactId>
<name>Quarkus - JSON-B</name>
<packaging>pom</packaging>
<modules>
<module>deployment</module>
<module>runtime</module>
</modules>
</project>
50 changes: 50 additions & 0 deletions extensions/jsonb/runtime/pom.xml
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>quarkus-jsonb-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-jsonb-runtime</artifactId>
<name>Quarkus - JSON-B - Runtime</name>

<dependencies>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-runtime</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsonp-runtime</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
44 changes: 44 additions & 0 deletions extensions/jsonp/deployment/pom.xml
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>quarkus-jsonp-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-jsonp</artifactId>
<name>Quarkus - JSON-P - Deployment</name>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsonp-runtime</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>

</project>
@@ -0,0 +1,34 @@
/*
* Copyright 2019 Red Hat, Inc.
*
* Licensed 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.
*/
package io.quarkus.jsonp.deployment;

import org.glassfish.json.JsonProviderImpl;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.substrate.SubstrateResourceBundleBuildItem;

public class JsonpProcessor {

@BuildStep
void build(BuildProducer<FeatureBuildItem> feature,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
BuildProducer<SubstrateResourceBundleBuildItem> resourceBundle) {
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, JsonProviderImpl.class.getName()));
}
}
20 changes: 20 additions & 0 deletions extensions/jsonp/pom.xml
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>quarkus-build-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../../build-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-jsonp-parent</artifactId>
<name>Quarkus - JSON-P</name>
<packaging>pom</packaging>
<modules>
<module>deployment</module>
<module>runtime</module>
</modules>
</project>

0 comments on commit 19092ac

Please sign in to comment.