Skip to content

Commit

Permalink
Merge pull request #69 from digipost/use-jakarta-compatible-jaxb
Browse files Browse the repository at this point in the history
Use Jakarta compatible JAXB
  • Loading branch information
runeflobakk authored May 5, 2023
2 parents 8a6f162 + f2dda65 commit e921454
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 93 deletions.
68 changes: 28 additions & 40 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,55 @@
name: Build and deploy
name: Build and publish
on: push

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '1.8', '11' ]

name: build java ${{ matrix.java }}
java: [ '8', '11', '17' ]
name: Build on Java ${{ matrix.java }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up java
uses: actions/setup-java@v1
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: "maven"
- name: Build with Maven
run: mvn -B package --no-transfer-progress --file pom.xml
run: mvn -B verify --no-transfer-progress --show-version

makeversion:
if: github.ref != 'refs/heads/main'

publishing_parameters:
needs: build
name: Publishing parameters
runs-on: ubuntu-latest
name: Create version
outputs:
is_release: ${{ steps.version.outputs.is_release }}
version: ${{ steps.version.outputs.version }}
steps:
- name: Decide on build version
- name: Determine version
id: version
run: |
if [[ $GITHUB_REF == *"tags"* ]]; then
TAG=${GITHUB_REF#refs/tags/}
is_release=true
version=${GITHUB_REF#refs/tags/}
else
TAG=${GITHUB_REF#refs/heads/}-SNAPSHOT
is_release=false
version=${GITHUB_REF#refs/heads/}-SNAPSHOT
fi
echo ::set-output name=version::${TAG//\//-}
echo "is_release=${is_release//\//-}" >> $GITHUB_OUTPUT
echo "version=${version//\//-}" >> $GITHUB_OUTPUT
deploy_snapshot:
if: startsWith(github.ref, 'refs/heads/')
needs: makeversion
runs-on: ubuntu-latest

name: Deploy snapshot
steps:
- uses: actions/checkout@v1
- uses: digipost/[email protected]
with:
sonatype_secrets: ${{ secrets.sonatype_secrets }}
release_version: ${{ needs.makeversion.outputs.version }}
perform_release: false
release:
if: startsWith(github.ref, 'refs/tags/')
publish:
needs: publishing_parameters
name: Publish ${{ needs.publishing_parameters.outputs.version }}
runs-on: ubuntu-latest
needs: makeversion
name: Release to Sonatype
steps:
- name: Check out Git repository
uses: actions/checkout@v1
- name: Release to Central Repository
uses: digipost/[email protected]
- uses: actions/checkout@v3
- uses: digipost/action-maven-publish@v1
with:
sonatype_secrets: ${{ secrets.sonatype_secrets }}
release_version: ${{ needs.makeversion.outputs.version }}
perform_release: true
release_version: ${{ needs.publishing_parameters.outputs.version }}
perform_release: ${{ needs.publishing_parameters.outputs.is_release }}
17 changes: 8 additions & 9 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,21 @@ specific language governing permissions and limitations
under the License.

This project includes:
Bean Validation API under Apache License 2.0
ClassMate under The Apache Software License, Version 2.0
Digipost Data Types under The Apache Software License, Version 2.0
Extended StAX API under Eclipse Distribution License - v 1.0
fastinfoset under Apache License, Version 2.0 or Eclipse Distribution License - v 1.0
Digipost JAXB Resolver - com.sun.xml.bind under The Apache Software License, Version 2.0
Expression Language 3.0 API under CDDL + GPLv2 with 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 Bean Validation API under Apache License 2.0
Jakarta Expression Language 3.0 under EPL 2.0 or GPL2 w/ CPE
jakarta.xml.bind-api under Eclipse Distribution License - v 1.0
JavaBeans Activation Framework API jar under EDL 1.0
JAXB Runtime under Eclipse Distribution License - v 1.0
Jakarta Expression Language 3.0 Implementation under EPL 2.0 or GPL2 w/ CPE
JavaBeans Activation Framework API jar under CDDL/GPLv2+CE
jaxb-api under CDDL 1.1 or GPL2 w/ CPE
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

90 changes: 62 additions & 28 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@

<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 All @@ -41,7 +48,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
<version>1.18.20</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -61,37 +68,50 @@
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>2.0.2</version>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.1.5.Final</version>
<scope>runtime</scope>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.el</artifactId>
<groupId>com.sun.el</groupId>
<artifactId>el-ri</artifactId>
<version>3.0.4</version>
<scope>runtime</scope>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.2</version>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
<groupId>no.digipost</groupId>
<artifactId>jaxb-resolver-com.sun.xml.bind</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -128,6 +148,18 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>no.digipost</groupId>
<artifactId>jul-to-slf4j-junit-extension</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
Expand All @@ -142,27 +174,29 @@
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<version>3.3.1</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.11.0</version>
<configuration>
<parameters>true</parameters>
</configuration>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<version>3.3.0</version>
<configuration>
<rules>
<requireMavenVersion>
<version>3.3.1</version>
<version>3.6.3</version>
</requireMavenVersion>
<bannedDependencies>
<excludes>
<exclude>javax.*</exclude>
<exclude>org.hamcrest:hamcrest-core</exclude>
</excludes>
</bannedDependencies>
Expand All @@ -171,33 +205,33 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<version>3.0.0</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<version>3.5.0</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<version>3.3.0</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<version>3.1.1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.7</version>
<version>2.15.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
Expand All @@ -222,7 +256,7 @@
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>1.18.10.0</version>
<version>1.18.20.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;

Expand All @@ -16,7 +16,7 @@ private static ObjectMapper initMapper() {
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.setPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CAMEL_CASE);
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.LOWER_CAMEL_CASE);
return mapper;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ void testJacksonJsonMarshallingAlltypes() {
static void testJacksonJsonMarshalling(DataTypeIdentifier example) {
try {
ObjectMapper mapper = DataTypesJsonMapper.getMapper();
mapper.enableDefaultTyping();
final String json = mapper.writer().writeValueAsString(example.getExample());
final DataType unmarshalled = mapper.reader().forType(example.getDataType()).readValue(json);
assertThat(unmarshalled, equalTo(example.getExample()));
Expand Down
Loading

0 comments on commit e921454

Please sign in to comment.