Skip to content

Commit

Permalink
chore: enable Java17 build
Browse files Browse the repository at this point in the history
  • Loading branch information
bguerin committed Oct 7, 2023
1 parent b8554a9 commit 0041e72
Show file tree
Hide file tree
Showing 32 changed files with 256 additions and 145 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildPlugin(
// cannot use this with Docker tests
useContainerAgent: false,
configurations: [
[ platform: "linux", jdk: "11" ],
[ platform: "linux", jdk: "17" ],
[ platform: "windows", jdk: "11" ]
]
)
1 change: 0 additions & 1 deletion pipeline-maven-spy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ public void verify_fingerprinting_of_dependencies() throws Exception {
"}";
// @formatter:on

String commonsLang3version35Md5 = "780b5a8b72eebe6d0dbff1c11b5658fa";
String commonsLang3version310Md5 = "3435b913691a5c1b173485a49850b1a8";

WorkflowJob firstPipeline;
{ // first job using commons-lang3:3.5
firstPipeline = jenkinsRule.createProject(WorkflowJob.class, "build-mono-dependency-maven-project-1");
firstPipeline.setDefinition(new CpsFlowDefinition(pipelineScript, true));
jenkinsRule.assertBuildStatus(Result.SUCCESS, firstPipeline.scheduleBuild2(0));

Fingerprint fingerprint = jenkinsRule.jenkins.getFingerprintMap().get(commonsLang3version35Md5);
Fingerprint fingerprint = jenkinsRule.jenkins.getFingerprintMap().get(commonsLang3version310Md5);
assertThat(fingerprint).isNotNull();

assertThat(fingerprint.getFileName())
.isEqualTo("org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar");
.isEqualTo("org/apache/commons/commons-lang3/3.13.0/commons-lang3-3.13.0.jar");
Fingerprint.BuildPtr original = fingerprint.getOriginal();
assertThat(original).isNull();
Hashtable<String, Fingerprint.RangeSet> usages = fingerprint.getUsages();
Expand All @@ -64,7 +64,7 @@ public void verify_fingerprinting_of_dependencies() throws Exception {
secondPipeline.setDefinition(new CpsFlowDefinition(pipelineScript, true));
jenkinsRule.assertBuildStatus(Result.SUCCESS, secondPipeline.scheduleBuild2(0));

Fingerprint fingerprint = jenkinsRule.jenkins.getFingerprintMap().get(commonsLang3version35Md5);
Fingerprint fingerprint = jenkinsRule.jenkins.getFingerprintMap().get(commonsLang3version310Md5);
assertThat(fingerprint).isNotNull();
Hashtable<String, Fingerprint.RangeSet> usages = fingerprint.getUsages();
assertThat(usages).hasSize(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,9 @@ public void maven_build_maven_hpi_project_on_master_succeeds() throws Exception
" git($/" + gitRepoRule.toString() + "/$)\n" +
" withMaven(traceability: true) {\n" +
" if (isUnix()) {\n" +
" sh 'mvn package'\n" +
" sh 'mvn -P!might-produce-incrementals package'\n" +
" } else {\n" +
" bat 'mvn package'\n" +
" bat 'mvn -P!might-produce-incrementals package'\n" +
" }\n" +
" }\n" +
"}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ public void testDisableAllPublishers() throws Exception {

// the jdk path is configured in Dockerfile
private static Stream<Arguments> jdkMapProvider() {
return Stream.of(arguments("jdk8", "/opt/java/jdk8"), arguments("jdk11", "/opt/java/jdk11"));
return Stream.of(
arguments("jdk8", "/opt/java/jdk8"),
arguments("jdk11", "/opt/java/jdk11"),
arguments("jdk17", "/opt/java/jdk17"));
}

@ParameterizedTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void test_infinite_loop() throws Exception {
assertThat(dependencies)
.contains(
dep("jenkins.mvn.test.multimodule", "shared-core", "jar", "0.0.1-SNAPSHOT", "compile"),
dep("junit", "junit", "jar", "4.13.1", "test"),
dep("junit", "junit", "jar", "4.13.2", "test"),
dep("org.hamcrest", "hamcrest-core", "jar", "1.3", "test"));

List<MavenArtifact> generatedArtifacts = GlobalPipelineMavenConfig.get()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM localhost/pipeline-maven/java-maven-git

COPY --from=eclipse-temurin:8u345-b01-jdk /opt/java/openjdk /opt/java/jdk8
COPY --from=eclipse-temurin:11.0.16.1_1-jdk /opt/java/openjdk /opt/java/jdk11
COPY --from=eclipse-temurin:8u382-b05-jdk /opt/java/openjdk /opt/java/jdk8
COPY --from=eclipse-temurin:11.0.20.1_1-jdk /opt/java/openjdk /opt/java/jdk11
COPY --from=eclipse-temurin:17.0.8.1_1-jdk /opt/java/openjdk /opt/java/jdk17
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
<groupId>jenkins.mvn.test</groupId>
<artifactId>test</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
</project>

Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,25 @@
<groupId>com.deploy.sample</groupId>
<artifactId>maven_deployfile_base_project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.deploy.sample</groupId>
<artifactId>maven_deployfile_dependency_project</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@
<artifactId>maven_deployfile_dependency_project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
</dependency>
</dependencies>
<properties>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
<artifactId>maven_docker_dependency_project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
Expand Down Expand Up @@ -33,6 +41,7 @@
</extensions>
</build>
<properties>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.26</version>
<version>4.74</version>
<relativePath />
</parent>

Expand All @@ -13,14 +13,14 @@
<packaging>hpi</packaging>
<properties>
<!-- make it match with the version used by the pipeline-maven-plugin to faster the downloads -->
<jenkins.version>2.7.3</jenkins.version>
<jenkins.version>2.387.3</jenkins.version>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?jelly escape-by-default='true'?>
<div>
Just a test project
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,31 @@
<groupId>jenkins.mvn.test</groupId>
<artifactId>mono-module-maven-app</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<version>3.1.2</version>
<executions>
<execution>
<goals>
Expand All @@ -33,20 +39,5 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>java11+</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>

Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,32 @@
<groupId>jenkins.mvn.test</groupId>
<artifactId>maven-jar-with-flattened-pom</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.0.0</version>
<version>1.5.0</version>
<configuration>
</configuration>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,31 @@
<groupId>jenkins.mvn.test</groupId>
<artifactId>jar-with-jacoco</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<version>3.1.2</version>
<executions>
<execution>
<goals>
Expand All @@ -35,7 +41,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<version>0.8.10</version>
<executions>
<execution>
<id>default-prepare-agent</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,26 @@
<groupId>jenkins.mvn.test</groupId>
<artifactId>my-jar-with-parent-pom</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.release>11</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

Loading

0 comments on commit 0041e72

Please sign in to comment.