Skip to content

Commit

Permalink
Migrating to Quarkus 3.0
Browse files Browse the repository at this point in the history
the main change is migrating from JavaEE to JakartaEE.

- update Quarkus bom from io.quarkus:quarkus-universe-bom to
io.quarkus.platform:quarkus-bom as it was deprecated since Quarkus 2.1
https://github.com/quarkusio/quarkus/wiki/Migration-Guide-2.1#quarkus-universe-bom-is-deprecated
(and it is required to use the Quarkus migration tool)
- launched quarkus `quarkus update --stream=3.0` as mentioned in
https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.0#automatic-update-tool
which dealt with a fair part of the migration. Then it remained few
little tasks.
- Updated one package-info annotation
- Updated from jakarta.websocket:jakarta.websocket-api to
io.quarkus:quarkus-websockets (another alternatives might be to add
jakarta.websocket:jakarta.websocket-client-api)
- Updated Jaxb generation. Moving from
org.jvnet.jaxb2.maven2:maven-jaxb2-plugin to
com.helger.maven:jaxb40-maven-plugin. Jaxb 3+ is supporting Jakarta.
using a fork which has implemented the support of Jacxb4. The initial
repository is not very active despite issue raised and a PR is proposed:
see highsource/jaxb-tools#253
- updated xjb files:
  - namespace from `http://java.sun.com/xml/ns/jaxb` to
`https://jakarta.ee/xml/ns/jaxb`
  - version from 1.2 to 3.0 (which is mandatory in accordance to the
namespace)
- Remove com.sun.xml.bind:jaxb-impl no more needed dependency

Signed-off-by: Aurélien Pupier <[email protected]>
  • Loading branch information
apupier committed Jun 28, 2023
1 parent ea063b3 commit 141d41c
Show file tree
Hide file tree
Showing 49 changed files with 127 additions and 129 deletions.
11 changes: 6 additions & 5 deletions commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ SPDX-License-Identifier: Apache-2.0
</dependency>

<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<scope>provided</scope>
<version>4.0.2</version>
</dependency>

<dependency>
Expand All @@ -68,9 +69,9 @@ SPDX-License-Identifier: Apache-2.0
<artifactId>hibernate-validator</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.el</artifactId>
<!--~~(No version provided)~~>--><dependency>
<groupId>org.glassfish.expressly</groupId>
<artifactId>expressly</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
import org.xml.sax.SAXException;

import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.Unmarshaller;
import javax.xml.transform.Result;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import org.lfenergy.compas.core.commons.constraint.impl.FilenameConstraintValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import org.lfenergy.compas.core.commons.constraint.impl.XmlAnyElementConstraintValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import org.lfenergy.compas.core.commons.constraint.FilenameValid;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.lfenergy.compas.core.commons.constraint.XmlAnyElementValid;
import org.w3c.dom.Element;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import java.util.List;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.commons.model;

import javax.validation.constraints.NotBlank;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import jakarta.validation.constraints.NotBlank;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;

import static org.lfenergy.compas.core.commons.CommonConstants.COMPAS_COMMONS_V1_NS_URI;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.commons.model;

import javax.validation.Valid;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.validation.Valid;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@XmlSchema(xmlns = {@XmlNs(prefix = "compas-commons", namespaceURI = COMPAS_COMMONS_V1_NS_URI)})
package org.lfenergy.compas.core.commons.model;

import javax.xml.bind.annotation.XmlNs;
import javax.xml.bind.annotation.XmlSchema;
import jakarta.xml.bind.annotation.XmlNs;
import jakarta.xml.bind.annotation.XmlSchema;

import static org.lfenergy.compas.core.commons.CommonConstants.COMPAS_COMMONS_V1_NS_URI;
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.lfenergy.compas.core.commons.model.XmlElementAPojo;
import org.lfenergy.compas.core.commons.model.XmlElementBPojo;

import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.Unmarshaller;
import java.util.UUID;

import static org.junit.jupiter.api.Assertions.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.junit.jupiter.api.Test;
import org.lfenergy.compas.core.commons.constraint.FilenameValid;

import javax.validation.Validation;
import javax.validation.Validator;
import jakarta.validation.Validation;
import jakarta.validation.Validator;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;

import javax.validation.Validation;
import javax.validation.Validator;
import jakarta.validation.Validation;
import jakarta.validation.Validator;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.commons.model;

import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlElementDecl;
import jakarta.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;

@XmlRegistry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.commons.model;

import javax.xml.bind.annotation.*;
import jakarta.xml.bind.annotation.*;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "XmlElementAPojo")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.core.commons.model;

import javax.xml.bind.annotation.*;
import jakarta.xml.bind.annotation.*;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "XmlElementBPojo")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2021 Alliander N.V.
//
// SPDX-License-Identifier: Apache-2.0
@XmlSchema(namespace = "https://www.lfenergy.org/compas/example", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
@XmlSchema(namespace = "https://www.lfenergy.org/compas/example", elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.lfenergy.compas.core.commons.model;

import javax.xml.bind.annotation.XmlSchema;
import jakarta.xml.bind.annotation.XmlSchema;
21 changes: 7 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ SPDX-License-Identifier: Apache-2.0
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<compas.scl.xsd.version>0.0.4</compas.scl.xsd.version>
<quarkus.platform.version>2.16.6.Final</quarkus.platform.version>
<jaxb.bind.version>2.3.8</jaxb.bind.version>
<quarkus.platform.version>3.0.4.Final</quarkus.platform.version>
<log4j2.version>2.20.0</log4j2.version>
<openpojo.version>0.9.1</openpojo.version>
</properties>
Expand Down Expand Up @@ -54,8 +53,8 @@ SPDX-License-Identifier: Apache-2.0
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-universe-bom</artifactId>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-bom</artifactId>
<version>${quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
Expand All @@ -77,12 +76,6 @@ SPDX-License-Identifier: Apache-2.0
<version>${compas.scl.xsd.version}</version>
</dependency>

<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.bind.version}</version>
</dependency>

<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
Expand Down Expand Up @@ -119,14 +112,14 @@ SPDX-License-Identifier: Apache-2.0
</plugin>

<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.15.3</version>
<groupId>com.helger.maven</groupId>
<artifactId>jaxb40-maven-plugin</artifactId>
<version>0.16.1</version>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-namespace-prefix</artifactId>
<version>1.3</version>
<version>2.0</version>
</dependency>
</dependencies>
<executions>
Expand Down
5 changes: 3 additions & 2 deletions rest-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ SPDX-License-Identifier: Apache-2.0
</dependency>

<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>3.1.0</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import org.lfenergy.compas.core.commons.exception.CompasException;
import org.lfenergy.compas.core.commons.model.ErrorResponse;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;

@Provider
public class CompasExceptionHandler implements ExceptionMapper<CompasException> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import org.apache.logging.log4j.Logger;
import org.lfenergy.compas.core.commons.model.ErrorResponse;

import javax.validation.ConstraintViolationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import jakarta.validation.ConstraintViolationException;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;

import static org.lfenergy.compas.core.commons.exception.CompasErrorCode.VALIDATION_ERROR;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import org.apache.logging.log4j.Logger;
import org.lfenergy.compas.core.commons.model.ErrorResponse;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;

import static org.lfenergy.compas.core.commons.exception.CompasErrorCode.UNKNOWN_EXCEPTION_ERROR;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.lfenergy.compas.core.commons.exception.CompasException;
import org.lfenergy.compas.core.commons.model.ErrorResponse;

import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.lfenergy.compas.core.commons.exception.CompasErrorCode.NO_CLASS_LOADER_ERROR_CODE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Path;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.ConstraintViolationException;
import jakarta.validation.Path;
import java.util.HashSet;

import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.lfenergy.compas.core.commons.exception.CompasErrorCode.VALIDATION_ERROR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.junit.jupiter.api.Test;
import org.lfenergy.compas.core.commons.model.ErrorResponse;

import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.lfenergy.compas.core.commons.exception.CompasErrorCode.UNKNOWN_EXCEPTION_ERROR;
Expand Down
5 changes: 2 additions & 3 deletions scl-extension/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ SPDX-License-Identifier: Apache-2.0
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.15.3</version>
<groupId>com.helger.maven</groupId>
<artifactId>jaxb40-maven-plugin</artifactId>
<executions>
<execution>
<id>xjc</id>
Expand Down
4 changes: 2 additions & 2 deletions scl-extension/src/main/bindings/scl-extensions.xjb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ SPDX-FileCopyrightText: 2021 Alliander N.V.
SPDX-License-Identifier: Apache-2.0
-->
<jxb:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
version="2.1">
xmlns:jxb="https://jakarta.ee/xml/ns/jaxb"
version="3.0">
<jxb:bindings schemaLocation="../resources/xsd/SCL_CoMPAS.xsd">
<jxb:bindings node="//xs:simpleType[@name='tCompasSclFileType']">
<jxb:typesafeEnumClass ref="org.lfenergy.compas.scl.extensions.model.SclFileType"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.scl.extensions.commons;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
import java.util.List;
import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.scl.extensions.model;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.XmlEnum;
import jakarta.xml.bind.annotation.XmlType;

import static org.lfenergy.compas.scl.extensions.commons.CompasExtensionsConstants.COMPAS_EXTENSION_NS_URI;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import org.junit.jupiter.api.Test;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.List;
Expand Down
Loading

0 comments on commit 141d41c

Please sign in to comment.