Support Java 11 JDK: replace maven plugin and legacy runtime libs

Cobertura is a maven plugin for test reporting. Cobertura is going to be
abandoned in terms of supporting Java versions >= 8. In order to natively
support Java 11 a different maven plugin was already used in the Jenkinsfile,
Jacoco. Jacoco is supports Java 11 out of the box. Only the already used
version needed a small upgrade to work.

Additionally, some runtime libraries are no longer bundled with Java 11
(like com.sun.* or Java EE libraries). These dependencies are now added
as explicit dependencies in the pom file.
This commit is contained in:
Philipp Pixel 2020-04-30 09:36:22 +02:00
parent 1cb8440818
commit c602b83282
No known key found for this signature in database
GPG key ID: 208125892E2AD8FB
2 changed files with 34 additions and 19 deletions

4
Jenkinsfile vendored
View file

@ -27,18 +27,16 @@ node {
archiveArtifacts artifacts: '**/target/*.jar' archiveArtifacts artifacts: '**/target/*.jar'
} }
String jacoco = "org.jacoco:jacoco-maven-plugin:0.8.1" String jacoco = "org.jacoco:jacoco-maven-plugin:0.8.5"
stage('Test') { stage('Test') {
mvn "${jacoco}:prepare-agent test ${jacoco}:report" mvn "${jacoco}:prepare-agent test ${jacoco}:report"
} }
stage('Integration Test') { stage('Integration Test') {
mvn "${jacoco}:prepare-agent-integration failsafe:integration-test failsafe:verify ${jacoco}:report-integration" mvn "${jacoco}:prepare-agent-integration failsafe:integration-test failsafe:verify ${jacoco}:report-integration"
} }
stage('Static Code Analysis') { stage('Static Code Analysis') {
def sonarQube = new SonarQube(this, [usernamePassword: credentialsId, sonarHostUrl: "${cesUrl}/sonar"]) def sonarQube = new SonarQube(this, [usernamePassword: credentialsId, sonarHostUrl: "${cesUrl}/sonar"])

49
pom.xml
View file

@ -18,6 +18,7 @@
<!-- Generic properties --> <!-- Generic properties -->
<java.version>1.8</java.version> <java.version>1.8</java.version>
<maven.compiler.release>8</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@ -25,14 +26,33 @@
<webjars-bootstrap.version>3.3.6</webjars-bootstrap.version> <webjars-bootstrap.version>3.3.6</webjars-bootstrap.version>
<webjars-jquery-ui.version>1.11.4</webjars-jquery-ui.version> <webjars-jquery-ui.version>1.11.4</webjars-jquery-ui.version>
<webjars-jquery.version>2.2.4</webjars-jquery.version> <webjars-jquery.version>2.2.4</webjars-jquery.version>
<wro4j.version>1.8.0</wro4j.version> <wro4j.version>1.9.0</wro4j.version>
<thymeleaf.version>3.0.6.RELEASE</thymeleaf.version> <thymeleaf.version>3.0.6.RELEASE</thymeleaf.version>
<cobertura.version>2.7</cobertura.version> <jacoco.version>0.8.5</jacoco.version>
</properties> </properties>
<dependencies> <dependencies>
<!-- API, java.xml.bind module -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.2</version>
</dependency>
<!-- Runtime, com.sun.xml.bind module -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
</dependency>
<!-- Apache CXF from Java 11 on - see https://stackoverflow.com/questions/55476331/tomcat8-5-and-openjdk11-noclassdeffounderror-could-not-initialize-class-org-apa -->
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>jakarta.activation</artifactId>
<version>1.2.1</version>
</dependency>
<!-- Spring and Spring Boot dependencies --> <!-- Spring and Spring Boot dependencies -->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -120,6 +140,14 @@
<build> <build>
<finalName>spring-petclinic</finalName> <finalName>spring-petclinic</finalName>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<release>8</release>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
@ -157,20 +185,9 @@
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.jacoco</groupId>
<artifactId>cobertura-maven-plugin</artifactId> <artifactId>jacoco-maven-plugin</artifactId>
<version>${cobertura.version}</version> <version>${jacoco.version}</version>
<configuration>
<check/>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
<!-- Spring Boot Actuator displays build-related information if a git.properties <!-- Spring Boot Actuator displays build-related information if a git.properties