Skip to content

Commit 45be11a

Browse files
committed
Merge branch 'jdk17' into 'main'
Moving to multi-release builds with JDK17 See merge request weblogic-cloud/weblogic-deploy-tooling!1524
2 parents e511dd4 + d3e7a78 commit 45be11a

File tree

14 files changed

+863
-60
lines changed

14 files changed

+863
-60
lines changed

Jenkinsfile

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ pipeline {
1515
stages {
1616
stage ('Environment') {
1717
tools {
18-
maven 'maven-3.8.7'
19-
jdk 'jdk8'
18+
maven 'maven-3.9.5'
19+
jdk 'jdk17'
2020
}
2121
steps {
2222
sh 'env|sort'
@@ -25,8 +25,8 @@ pipeline {
2525
}
2626
stage ('Build') {
2727
tools {
28-
maven 'maven-3.8.7'
29-
jdk 'jdk8'
28+
maven 'maven-3.9.5'
29+
jdk 'jdk17'
3030
}
3131
steps {
3232
// Using Maven batch mode to suppress download progress lines in Jenkins output
@@ -41,7 +41,7 @@ pipeline {
4141
docker {
4242
alwaysPull true
4343
reuseNode true
44-
image 'phx.ocir.io/devweblogic/wdt/jenkins-slave:122130'
44+
image 'phx.ocir.io/devweblogic/wdt/jenkins-slave:12.2.1.3.0'
4545
args "-u ${jenkins_uid}:${jenkins_gid} --group-add oracle --group-add opc -v /var/run/docker.sock:/var/run/docker.sock"
4646
}
4747
}
@@ -68,7 +68,7 @@ pipeline {
6868
docker {
6969
alwaysPull true
7070
reuseNode true
71-
image "phx.ocir.io/${wdt_tenancy}/wdt/jenkins-slave:122130"
71+
image "phx.ocir.io/${wdt_tenancy}/wdt/jenkins-slave:12.2.1.3.0"
7272
args "-u ${jenkins_uid}:${docker_gid} --group-add oracle --group-add opc --group-add docker -v /var/run/docker.sock:/var/run/docker.sock"
7373
}
7474
}

core/pom.xml

+68
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,80 @@
9797
</resource>
9898
</resources>
9999
<plugins>
100+
<plugin>
101+
<groupId>org.apache.maven.plugins</groupId>
102+
<artifactId>maven-enforcer-plugin</artifactId>
103+
<executions>
104+
<execution>
105+
<id>enforce-build-environment</id>
106+
<goals>
107+
<goal>enforce</goal>
108+
</goals>
109+
<configuration>
110+
<rules>
111+
<requireJavaVersion>
112+
<version>17</version>
113+
<message>You must use JDK 17 to build the project</message>
114+
</requireJavaVersion>
115+
</rules>
116+
</configuration>
117+
</execution>
118+
<execution>
119+
<id>enforce-wlst</id>
120+
<goals>
121+
<goal>enforce</goal>
122+
</goals>
123+
<configuration>
124+
<skip>${skipTests}</skip>
125+
<rules>
126+
<requireProperty>
127+
<property>unit-test-wlst-dir</property>
128+
<message>Unable to find WLST in order to run unit tests. Please set the unit-test-wlst-dir System property to point to the directory where wlst.sh lives in the Oracle Home. Or, set WLST_DIR environment variable. An example can be found in .mvn/maven.config-template. Optionally, you may -DskipTests.
129+
</message>
130+
</requireProperty>
131+
</rules>
132+
</configuration>
133+
</execution>
134+
</executions>
135+
</plugin>
136+
<plugin>
137+
<groupId>org.apache.maven.plugins</groupId>
138+
<artifactId>maven-compiler-plugin</artifactId>
139+
<executions>
140+
<execution>
141+
<id>default-compile</id>
142+
<goals>
143+
<goal>compile</goal>
144+
</goals>
145+
<configuration>
146+
<source>${maven.compiler.source}</source>
147+
<target>${maven.compiler.target}</target>
148+
</configuration>
149+
</execution>
150+
<execution>
151+
<id>compile-java-17</id>
152+
<goals>
153+
<goal>compile</goal>
154+
</goals>
155+
<configuration>
156+
<release>17</release>
157+
<source>17</source>
158+
<target>17</target>
159+
<compileSourceRoots>
160+
<compileSourceRoot>${project.basedir}/src/main/java17</compileSourceRoot>
161+
</compileSourceRoots>
162+
<multiReleaseOutput>true</multiReleaseOutput>
163+
</configuration>
164+
</execution>
165+
</executions>
166+
</plugin>
100167
<plugin>
101168
<groupId>org.apache.maven.plugins</groupId>
102169
<artifactId>maven-jar-plugin</artifactId>
103170
<configuration>
104171
<archive>
105172
<manifestEntries>
173+
<Multi-Release>true</Multi-Release>
106174
<Class-Path>antlr4-runtime-${antlr.version}.jar snakeyaml-${snakeyaml.version}.jar picocli-${picocli.version}.jar</Class-Path>
107175
</manifestEntries>
108176
</archive>

core/src/main/java/oracle/weblogic/deploy/logging/LoggingUtils.java

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ private LoggingUtils() {
2222
* @param logRecord the log record to copy
2323
* @return the cloned log record without the exception
2424
*/
25+
@SuppressWarnings("deprecation")
2526
public static LogRecord cloneRecordWithoutException(LogRecord logRecord) {
2627
LogRecord newRecord = new LogRecord(logRecord.getLevel(), logRecord.getMessage());
2728

core/src/main/java/oracle/weblogic/deploy/logging/PlatformLogger.java

+1
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,7 @@ CallerDetails inferCaller() {
647647
return details;
648648
}
649649

650+
@SuppressWarnings("deprecation")
650651
private LogRecord getLogRecord(Level level, CallerDetails details, String msg, Throwable error, Object... params) {
651652
LogRecord logRecord = new LogRecord(level, msg);
652653
logRecord.setLoggerName(this.getName());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (c) 2019, 2022, Oracle Corporation and/or its affiliates.
3+
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
*/
5+
package oracle.weblogic.deploy.logging;
6+
7+
import java.util.Properties;
8+
import java.util.logging.LogRecord;
9+
10+
/**
11+
* Utility class with methods used by the logging framework.
12+
*/
13+
public class LoggingUtils {
14+
15+
private LoggingUtils() {
16+
// hide the constructor
17+
}
18+
19+
/**
20+
* Make a copy of a log record without the exception.
21+
*
22+
* @param logRecord the log record to copy
23+
* @return the cloned log record without the exception
24+
*/
25+
public static LogRecord cloneRecordWithoutException(LogRecord logRecord) {
26+
LogRecord newRecord = new LogRecord(logRecord.getLevel(), logRecord.getMessage());
27+
28+
newRecord.setLoggerName(logRecord.getLoggerName());
29+
newRecord.setInstant(logRecord.getInstant());
30+
newRecord.setParameters(logRecord.getParameters());
31+
newRecord.setResourceBundle(logRecord.getResourceBundle());
32+
newRecord.setResourceBundleName(logRecord.getResourceBundleName());
33+
newRecord.setSequenceNumber(logRecord.getSequenceNumber());
34+
newRecord.setSourceClassName(logRecord.getSourceClassName());
35+
newRecord.setSourceMethodName(logRecord.getSourceMethodName());
36+
newRecord.setLongThreadID(logRecord.getLongThreadID());
37+
// Skip thrown
38+
return newRecord;
39+
}
40+
41+
public static void printLogProperties(Properties logProps, String prefix) {
42+
if (logProps != null) {
43+
for (String propName : logProps.stringPropertyNames()) {
44+
System.err.println(prefix + propName + '=' + logProps.getProperty(propName));
45+
}
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)