Skip to content

Commit

Permalink
use quarkus 1.12.0.Final (#42)
Browse files Browse the repository at this point in the history
* use quarkus 1.12.0.Final
cleanup poms
newest pc parent

* remove some test dependencies

* remove build extras

* remove imports

* more fixes

* update to 1.13.1.Final

* new graalvm version

* correctly customize object mapper

* fix tests
  • Loading branch information
Postremus authored Apr 10, 2021
1 parent c2c0a22 commit 910e297
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 223 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Stage 1 : build with maven builder image with native capabilities
FROM quay.io/quarkus/centos-quarkus-maven:20.2.0-java11 AS build
FROM quay.io/quarkus/centos-quarkus-maven:21.0-java11 AS build
COPY . /usr/src/app/
RUN mvn -f /usr/src/app/pom.xml -B de.qaware.maven:go-offline-maven-plugin:1.2.5:resolve-dependencies
USER root
Expand Down
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pipeline {
}
stage ('Build') {
steps {
sh 'mvn install -P docker,docker-it,build-extras,jenkins-ci'
sh 'mvn install -P docker-it,jenkins-ci'
}
}
stage ('Deploy') {
Expand All @@ -43,7 +43,7 @@ pipeline {
file(credentialsId: 'mavensigningkey', variable: 'MAVEN_SIGNING_KEY')
]) {
sh "gpg --batch --fast-import ${env.MAVEN_SIGNING_KEY}"
sh 'mvn -DskipTests deploy -s cd/settings.xml -P sign,docker,build-extras'
sh 'mvn -DskipTests deploy -s cd/settings.xml -P sign'
}
}
}
Expand Down
170 changes: 43 additions & 127 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,38 @@
<parent>
<groupId>com.pro-crafting</groupId>
<artifactId>pc-parent</artifactId>
<version>9</version>
<version>10</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<groupId>com.pro-crafting.tools</groupId>
<artifactId>record-jar-converter-web</artifactId>

<version>1.6.1-SNAPSHOT</version>
<packaging>jar</packaging>
<version>1.7.0-SNAPSHOT</version>

<scm>
<connection>scm:git:[email protected]:pro-crafting/record-jar-converter.git</connection>
<url>https://github.com/pro-crafting/record-jar-converter</url>
<developerConnection>scm:git:[email protected]:pro-crafting/record-jar-converter.git</developerConnection>
<tag>HEAD</tag>
</scm>

<properties>
<!-- Settings -->
<docker.name>postremus/${project.artifactId}:${project.version}</docker.name>
<file.runner>${project.build.finalName}-runner.jar</file.runner>

<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<docker.repository>postremus</docker.repository>
<!-- Port is set during execution of build-helper-maven-plugin:reserve-network-port goal -->
<it.baseuri>127.0.0.1</it.baseuri>
<sonar.organization>pro-crafting</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

<!-- Dependency Versions -->
<version.quarkus>1.8.1.Final</version.quarkus>
<version.quarkus>1.13.1.Final</version.quarkus>

<!-- Plugin Versions -->
<version.docker-maven-plugin>0.34.0</version.docker-maven-plugin>
<version.maven-surefire-plugin>2.21.0</version.maven-surefire-plugin>
<version.maven-failsafe-plugin>2.21.0</version.maven-failsafe-plugin>
<version.sonar-maven-plugin>3.4.1.1168</version.sonar-maven-plugin>
<version.maven-failsafe-plugin>3.0.0-M5</version.maven-failsafe-plugin>

<!-- Test Dependency Versions -->
<junit.jupiter.version>5.2.0</junit.jupiter.version>
<junit.platform.version>1.2.0</junit.platform.version>
<version.mockito-core>2.18.3</version.mockito-core>
<version.rest-assured>3.1.0</version.rest-assured>
</properties>

Expand All @@ -54,7 +49,6 @@
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${version.docker-maven-plugin}</version>
<executions>
<execution>
<id>push</id>
Expand All @@ -65,22 +59,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.maven-surefire-plugin}</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit.platform.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>${version.sonar-maven-plugin}</version>
</plugin>
</plugins>

</pluginManagement>
Expand All @@ -101,17 +79,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.maven-failsafe-plugin}</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit.platform.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>${version.sonar-maven-plugin}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand All @@ -134,6 +106,31 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${docker.repository}/record-jar-converter-web</name>
<run>
<containerNamePattern>%a-%t-%i</containerNamePattern>
<ports>
<port>${docker.published.port}:8080</port>
</ports>
</run>
<build>
<contextDir>${project.basedir}</contextDir>

<tags>
<tag>latest</tag>
<tag>${project.version}</tag>
</tags>
</build>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>

Expand All @@ -149,35 +146,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${version.mockito-core}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${version.mockito-core}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${version.rest-assured}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand All @@ -193,11 +161,11 @@
<!-- Quarkus Extensions -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
<artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson</artifactId>
<groupId>io.quarkus </groupId>
<artifactId>quarkus-resteasy-multipart</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand All @@ -207,10 +175,6 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-metrics</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus </groupId>
<artifactId>quarkus-resteasy-multipart</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus </groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
Expand All @@ -219,23 +183,14 @@

<!-- Test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${version.rest-assured}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -251,38 +206,6 @@
</dependencies>

<profiles>
<profile>
<id>docker</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>${docker.repository}/record-jar-converter-web</name>
<run>
<containerNamePattern>%a-%t-%i</containerNamePattern>
<ports>
<port>${docker.published.port}:8080</port>
</ports>
</run>
<build>
<contextDir>${project.basedir}</contextDir>

<tags>
<tag>latest</tag>
<tag>${project.version}</tag>
</tags>
</build>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>docker-it</id>
<build>
Expand Down Expand Up @@ -361,11 +284,4 @@
</properties>
</profile>
</profiles>

<scm>
<connection>scm:git:[email protected]:pro-crafting/record-jar-converter.git</connection>
<url>https://github.com/pro-crafting/record-jar-converter</url>
<developerConnection>scm:git:[email protected]:pro-crafting/record-jar-converter.git</developerConnection>
<tag>HEAD</tag>
</scm>
</project>
Original file line number Diff line number Diff line change
@@ -1,48 +1,22 @@
package com.pro_crafting.tools.recordjarconverter.representation.json;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationConfig;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider;
import com.fasterxml.jackson.databind.ser.SerializerFactory;
import com.google.common.collect.Multimap;
import com.pro_crafting.tools.recordjarconverter.representation.json.module.RecordModule;
import io.quarkus.jackson.ObjectMapperCustomizer;

import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;
import javax.enterprise.context.ApplicationScoped;

@Provider
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.WILDCARD)
public class ObjectMapperProvider implements ContextResolver<ObjectMapper> {
@ApplicationScoped
public class ObjectMapperProvider implements ObjectMapperCustomizer {

private static ObjectMapper mapper;

static {
mapper = new ObjectMapper();
mapper.findAndRegisterModules();
mapper.registerModule(new RecordModule());
mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
@Override
public void customize(ObjectMapper objectMapper) {
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);

// Custom serializers
SimpleModule serializerModule = new SimpleModule();
serializerModule.addSerializer(new MultimapSerializer());

mapper.registerModule(serializerModule);
}

public static ObjectMapper getMapper() {
return mapper;
}

@Override
public ObjectMapper getContext(Class<?> type) {
return mapper;
objectMapper.registerModule(serializerModule);
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class RecordJarFullResource {
responseCode = "400", description = "400 Bad Request. Violations are present in the body.", content = @Content(schema = @Schema(implementation = Violation.class, type = SchemaType.ARRAY))
)
})
public Response uploadMultipartFile(@MultipartForm RecordJarFile recordJarFile) throws FileNotFoundException {
public Response uploadMultipartFile(@MultipartForm RecordJarFile recordJarFile) {
List<Record> records = service.convert(recordJarFile.getFile(), recordJarFile.getEncoding());
return Response.ok().entity(records).build();
}
Expand Down
Loading

0 comments on commit 910e297

Please sign in to comment.