Skip to content

Commit

Permalink
Upgrade to jakarta xml bind
Browse files Browse the repository at this point in the history
Some plugins behave differently. jaxb2-maven-plugin started picking
up classes on the rot of package "no.digipost.api.datatypes"
and this created a new schema-file. I resolved that by scoping the
lombok-plugin to only check the types-folder for types that
should be included in the datatypes.xsd.
  • Loading branch information
eivinhb committed Nov 28, 2023
1 parent b602632 commit 0880c98
Show file tree
Hide file tree
Showing 70 changed files with 647 additions and 748 deletions.
12 changes: 7 additions & 5 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,23 @@ specific language governing permissions and limitations
under the License.

This project includes:
Angus Activation Registries under EDL 1.0
ClassMate under Apache License, Version 2.0
Digipost Data Types under The Apache Software License, Version 2.0
Digipost JAXB Resolver - com.sun.xml.bind under The Apache Software License, Version 2.0
Eclipse Expressly under Eclipse Public License v. 2.0 or GNU General Public License, version 2 with the GNU Classpath Exception
Hibernate Validator Engine under Apache License 2.0
istack common utility code runtime under Eclipse Distribution License - v 1.0
Jackson datatype: JSR310 under The Apache Software License, Version 2.0
Jackson-annotations under The Apache Software License, Version 2.0
Jackson-core under The Apache Software License, Version 2.0
jackson-databind under The Apache Software License, Version 2.0
Jakarta Activation API under EDL 1.0
Jakarta Bean Validation API under Apache License 2.0
Jakarta Expression Language API under Eclipse Public License v. 2.0 or GNU General Public License, version 2 with the GNU Classpath Exception
JavaBeans Activation Framework API jar under CDDL/GPLv2+CE
jaxb-api under CDDL 1.1 or GPL2 w/ CPE
Jakarta XML Binding API under Eclipse Distribution License - v 1.0
JAXB Core under Eclipse Distribution License - v 1.0
JAXB Runtime under Eclipse Distribution License - v 1.0
JBoss Logging 3 under Apache License, version 2.0
Old JAXB Core under CDDL+GPL License
Old JAXB Runtime under Eclipse Distribution License - v 1.0
Project Lombok under The MIT License
TXW2 Runtime under Eclipse Distribution License - v 1.0

993 changes: 464 additions & 529 deletions datatypes.xsd

Large diffs are not rendered by default.

40 changes: 13 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>no.digipost</groupId>
<artifactId>jaxb-resolver-com.sun.xml.bind-bom</artifactId>
<version>1.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
Expand Down Expand Up @@ -72,7 +65,7 @@
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>3.0.2</version>
</dependency>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
Expand All @@ -95,12 +88,14 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>no.digipost</groupId>
<artifactId>jaxb-resolver-com.sun.xml.bind</artifactId>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>4.0.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -256,15 +251,15 @@
</dependency>
</dependencies>
<configuration>
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
<sourceDirectory>${project.build.sourceDirectory}/no/digipost/api/datatypes/types/</sourceDirectory>
<outputDirectory>${project.build.directory}/schemagen-work/lombok</outputDirectory>
<addOutputDirectory>false</addOutputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.3.1</version>
<version>3.1.0</version>
<executions>
<execution>
<id>schemagen</id>
Expand All @@ -277,28 +272,19 @@
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.2</version>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
<version>4.0.4</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<configuration>
<sources>
<source>${project.build.directory}/schemagen-work/lombok</source>
</sources>
<schemaSourceExcludeFilters>
<filter implementation="org.codehaus.mojo.jaxb2.shared.filters.pattern.PatternFileFilter">
<patterns>
<pattern>marshalling</pattern>
<pattern>validation</pattern>
<pattern>documentation</pattern>
</patterns>
</filter>
</schemaSourceExcludeFilters>
<transformSchemas>
<transformSchema>
<uri>http://api.digipost.no/schema/datatypes</uri>
Expand Down Expand Up @@ -348,8 +334,8 @@
</plugin>
<plugin>
<groupId>org.jasig.maven</groupId>
<artifactId>maven-notice-plugin</artifactId>
<version>1.1.0</version>
<artifactId>notice-maven-plugin</artifactId>
<version>2.0.0</version>
<configuration>
<excludeScopes>
<excludeScope>test</excludeScope>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package no.digipost.api.datatypes.documentation;

import jakarta.xml.bind.JAXBException;
import no.digipost.api.datatypes.DataType;
import no.digipost.api.datatypes.DataTypeIdentifier;
import no.digipost.api.datatypes.marshalling.DataTypesJAXBContext;

import javax.xml.bind.JAXBException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package no.digipost.api.datatypes.documentation;

import jakarta.validation.constraints.NotNull;
import jakarta.xml.bind.annotation.XmlElement;
import no.digipost.api.datatypes.ComplementedBy;

import javax.xml.bind.annotation.XmlElement;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.SerializationFeature;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
import no.digipost.api.datatypes.marshalling.DataTypesJsonMapper;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import java.io.StringWriter;
import java.util.HashSet;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package no.digipost.api.datatypes.marshalling;

import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.Unmarshaller;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;
import no.digipost.api.datatypes.DataType;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.dom.DOMSource;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package no.digipost.api.datatypes.marshalling;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;

public class DataTypesJAXBContext {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.digipost.api.datatypes.marshalling;

import javax.xml.bind.annotation.adapters.XmlAdapter;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package no.digipost.api.datatypes.marshalling;

import javax.xml.bind.annotation.adapters.XmlAdapter;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;

import java.math.BigDecimal;

import static java.math.BigDecimal.ROUND_HALF_UP;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package no.digipost.api.datatypes.marshalling;

import javax.xml.bind.DatatypeConverter;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import jakarta.xml.bind.DatatypeConverter;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;

import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/no/digipost/api/datatypes/types/Address.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package no.digipost.api.datatypes.types;

import jakarta.validation.constraints.Size;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Value;
import lombok.With;
import no.digipost.api.datatypes.documentation.Description;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

@XmlType
@Value
@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
Expand All @@ -11,8 +13,6 @@
import no.digipost.api.datatypes.DataType;
import no.digipost.api.datatypes.documentation.Description;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.List;
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/no/digipost/api/datatypes/types/Barcode.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package no.digipost.api.datatypes.types;

import jakarta.validation.constraints.Size;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Value;
import lombok.With;
import no.digipost.api.datatypes.documentation.Description;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

@XmlType
@Value
@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
Expand All @@ -13,8 +15,6 @@
import no.digipost.api.datatypes.DataType;
import no.digipost.api.datatypes.documentation.Description;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Collections;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/no/digipost/api/datatypes/types/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
Expand All @@ -11,8 +13,6 @@
import no.digipost.api.datatypes.DataType;
import no.digipost.api.datatypes.documentation.Description;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;

import static java.util.Collections.singletonList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlSchemaType;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
Expand All @@ -11,9 +14,6 @@
import no.digipost.api.datatypes.documentation.Description;
import no.digipost.api.datatypes.validation.WebUrl;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import java.net.URI;
import java.time.ZoneId;
import java.time.ZonedDateTime;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package no.digipost.api.datatypes.types;

import jakarta.validation.constraints.Size;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Value;
import lombok.With;
import no.digipost.api.datatypes.documentation.Description;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.math.BigDecimal;

@XmlType
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/no/digipost/api/datatypes/types/Heftelse.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Value;
import lombok.With;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

@XmlType
@Value
@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Value;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

@XmlType
@Value
@AllArgsConstructor
Expand Down
Loading

0 comments on commit 0880c98

Please sign in to comment.