Skip to content

Commit

Permalink
Upgrade 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 quarkus.index-dependency for jaxb from
org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.3_spec to
`jakarta.xml.bind:jakarta.xml.bind-api`

fix com-pas#333

current test failure:
```
[ERROR] org.lfenergy.compas.cim.mapping.rest.v1.CompasCimMappingResourceTest.mapCimToScl_WhenCalled_ThenCorrectMessageIsRetrieved
Time elapsed: 1.465 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: not <null>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:152)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertNotNull.failNull(AssertNotNull.java:49)
	at org.junit.jupiter.api.AssertNotNull.assertNotNull(AssertNotNull.java:35)
	at org.junit.jupiter.api.AssertNotNull.assertNotNull(AssertNotNull.java:30)
	at org.junit.jupiter.api.Assertions.assertNotNull(Assertions.java:301)
	at org.lfenergy.compas.cim.mapping.rest.v1.CompasCimMappingResourceTest.mapCimToScl_WhenCalled_ThenCorrectMessageIsRetrieved(CompasCimMappingResourceTest.java:70)
```
suspect logs:
```
2023-05-26 16:28:42,577 WARN  [io.qua.dep.ste.ReflectiveHierarchyStep]
(build-26) Unable to properly register the hierarchy of the following
classes for reflection as they are not in the Jandex index:
	- javax.xml.bind.JAXBElement (source: SmallRyeOpenApiProcessor >
org.lfenergy.compas.cim.mapping.rest.v1.model.MapResponse)
	- javax.xml.namespace.QName (source: SmallRyeOpenApiProcessor >
org.lfenergy.compas.cim.mapping.rest.v1.model.MapResponse)
Consider adding them to the index either by creating a Jandex index for
your dependency via the Maven plugin, an empty META-INF/beans.xml or
quarkus.index-dependency properties.
2023-05-26 16:28:42,895 WARN  [io.qua.arc.pro.BeanArchives] (build-20)
Failed to index javax.xml.bind.JAXBElement: Class does not exist in
ClassLoader QuarkusClassLoader:Deployment Class Loader: TEST@4c579b5b
```
even if before migration there is similar (but not exactly the same)
warning:
```
[WARNING] [io.quarkus.deployment.steps.ReflectiveHierarchyStep] Unable
to properly register the hierarchy of the following classes for
reflection as they are not in the Jandex index:
	- javax.xml.namespace.QName (source: SmallRyeOpenApiProcessor >
org.lfenergy.compas.cim.mapping.rest.v1.model.MapResponse)
Consider adding them to the index either by creating a Jandex index for
your dependency via the Maven plugin, an empty META-INF/beans.xml or
quarkus.index-dependency properties.
```

Signed-off-by: Aurélien Pupier <[email protected]>
  • Loading branch information
apupier committed May 26, 2023
1 parent a078aa8 commit bca4aa7
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import io.quarkus.runtime.annotations.RegisterForReflection;
import org.lfenergy.compas.cim.mapping.mapper.CimToSclMapper;

import javax.enterprise.inject.Produces;
import jakarta.enterprise.inject.Produces;

/**
* Create Beans from other dependencies that are used in the application.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Liveness;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;

@Liveness
@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Readiness;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;

@Readiness
@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
import org.lfenergy.compas.cim.mapping.rest.v1.model.MapResponse;
import org.lfenergy.compas.cim.mapping.service.CompasCimMappingService;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.validation.Valid;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.validation.Valid;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;

@Authenticated
@RequestScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.lfenergy.compas.cim.mapping.model.CimData;

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.List;

import static org.lfenergy.compas.cim.mapping.CimMappingConstants.CIM_MAPPING_SERVICE_V1_NS_URI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.lfenergy.compas.scl2007b4.model.SCL;

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.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;

import static org.lfenergy.compas.cim.mapping.CimMappingConstants.CIM_MAPPING_SERVICE_V1_NS_URI;
import static org.lfenergy.compas.cim.mapping.CimMappingConstants.SCL_NS_URI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)
package org.lfenergy.compas.cim.mapping.rest.v1.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.cim.mapping.CimMappingConstants.CIM_MAPPING_SERVICE_V1_NS_URI;
4 changes: 2 additions & 2 deletions app/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ quarkus.index-dependency.rest-commons.artifact-id = rest-commons
quarkus.index-dependency.scl2007b4.group-id = org.lfenergy.compas.core
quarkus.index-dependency.scl2007b4.artifact-id = scl2007b4

quarkus.index-dependency.jaxb-api.group-id = org.jboss.spec.javax.xml.bind
quarkus.index-dependency.jaxb-api.artifact-id = jboss-jaxb-api_2.3_spec
quarkus.index-dependency.jaxb-api.group-id = jakarta.xml.bind
quarkus.index-dependency.jaxb-api.artifact-id = jakarta.xml.bind-api

# Settings needed for native compilation of the project.
quarkus.native.resources.includes=**/com.powsybl.triplestore.api.TripleStoreFactoryService,CIM*.sparql
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SPDX-License-Identifier: Apache-2.0

<compas.core.version>0.11.0</compas.core.version>

<quarkus.platform.version>2.16.6.Final</quarkus.platform.version>
<quarkus.platform.version>3.0.4.Final</quarkus.platform.version>
<microprofile-openapi-api.version>3.1</microprofile-openapi-api.version>
<powsybl.version>5.1.1</powsybl.version>
<log4j2.version>2.20.0</log4j2.version>
Expand Down Expand Up @@ -57,8 +57,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 Down
6 changes: 3 additions & 3 deletions service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,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>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.lfenergy.compas.cim.mapping.exception.CompasCimMappingException;
import org.lfenergy.compas.cim.mapping.model.CimData;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;
import java.io.InputStream;
import java.io.StringReader;
import java.nio.charset.StandardCharsets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import org.lfenergy.compas.cim.mapping.constraint.impl.CimDataNamePatternValidator;

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 @@ -6,8 +6,8 @@
import com.powsybl.cgmes.model.CgmesSubset;
import org.lfenergy.compas.cim.mapping.constraint.CimDataNamePattern;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import java.util.Arrays;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.lfenergy.compas.cim.mapping.constraint.CimDataNamePattern;

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

import static org.lfenergy.compas.cim.mapping.CimMappingConstants.CIM_MAPPING_SERVICE_V1_NS_URI;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import org.lfenergy.compas.scl2007b4.model.THeader;
import org.lfenergy.compas.scl2007b4.model.THitem;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
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.cim.mapping.constraint.CimDataNamePattern;

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

0 comments on commit bca4aa7

Please sign in to comment.