Skip to content

Commit

Permalink
Merge branch 'jdk17' into 'main'
Browse files Browse the repository at this point in the history
Moving to multi-release builds with JDK17

See merge request weblogic-cloud/weblogic-deploy-tooling!1524
  • Loading branch information
robertpatrick committed Oct 24, 2023
2 parents e511dd4 + d3e7a78 commit 45be11a
Show file tree
Hide file tree
Showing 14 changed files with 863 additions and 60 deletions.
12 changes: 6 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ pipeline {
stages {
stage ('Environment') {
tools {
maven 'maven-3.8.7'
jdk 'jdk8'
maven 'maven-3.9.5'
jdk 'jdk17'
}
steps {
sh 'env|sort'
Expand All @@ -25,8 +25,8 @@ pipeline {
}
stage ('Build') {
tools {
maven 'maven-3.8.7'
jdk 'jdk8'
maven 'maven-3.9.5'
jdk 'jdk17'
}
steps {
// Using Maven batch mode to suppress download progress lines in Jenkins output
Expand All @@ -41,7 +41,7 @@ pipeline {
docker {
alwaysPull true
reuseNode true
image 'phx.ocir.io/devweblogic/wdt/jenkins-slave:122130'
image 'phx.ocir.io/devweblogic/wdt/jenkins-slave:12.2.1.3.0'
args "-u ${jenkins_uid}:${jenkins_gid} --group-add oracle --group-add opc -v /var/run/docker.sock:/var/run/docker.sock"
}
}
Expand All @@ -68,7 +68,7 @@ pipeline {
docker {
alwaysPull true
reuseNode true
image "phx.ocir.io/${wdt_tenancy}/wdt/jenkins-slave:122130"
image "phx.ocir.io/${wdt_tenancy}/wdt/jenkins-slave:12.2.1.3.0"
args "-u ${jenkins_uid}:${docker_gid} --group-add oracle --group-add opc --group-add docker -v /var/run/docker.sock:/var/run/docker.sock"
}
}
Expand Down
68 changes: 68 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,80 @@
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-build-environment</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireJavaVersion>
<version>17</version>
<message>You must use JDK 17 to build the project</message>
</requireJavaVersion>
</rules>
</configuration>
</execution>
<execution>
<id>enforce-wlst</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<skip>${skipTests}</skip>
<rules>
<requireProperty>
<property>unit-test-wlst-dir</property>
<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.
</message>
</requireProperty>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</execution>
<execution>
<id>compile-java-17</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>17</release>
<source>17</source>
<target>17</target>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java17</compileSourceRoot>
</compileSourceRoots>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
<Class-Path>antlr4-runtime-${antlr.version}.jar snakeyaml-${snakeyaml.version}.jar picocli-${picocli.version}.jar</Class-Path>
</manifestEntries>
</archive>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ private LoggingUtils() {
* @param logRecord the log record to copy
* @return the cloned log record without the exception
*/
@SuppressWarnings("deprecation")
public static LogRecord cloneRecordWithoutException(LogRecord logRecord) {
LogRecord newRecord = new LogRecord(logRecord.getLevel(), logRecord.getMessage());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ CallerDetails inferCaller() {
return details;
}

@SuppressWarnings("deprecation")
private LogRecord getLogRecord(Level level, CallerDetails details, String msg, Throwable error, Object... params) {
LogRecord logRecord = new LogRecord(level, msg);
logRecord.setLoggerName(this.getName());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2019, 2022, Oracle Corporation and/or its affiliates.
* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
*/
package oracle.weblogic.deploy.logging;

import java.util.Properties;
import java.util.logging.LogRecord;

/**
* Utility class with methods used by the logging framework.
*/
public class LoggingUtils {

private LoggingUtils() {
// hide the constructor
}

/**
* Make a copy of a log record without the exception.
*
* @param logRecord the log record to copy
* @return the cloned log record without the exception
*/
public static LogRecord cloneRecordWithoutException(LogRecord logRecord) {
LogRecord newRecord = new LogRecord(logRecord.getLevel(), logRecord.getMessage());

newRecord.setLoggerName(logRecord.getLoggerName());
newRecord.setInstant(logRecord.getInstant());
newRecord.setParameters(logRecord.getParameters());
newRecord.setResourceBundle(logRecord.getResourceBundle());
newRecord.setResourceBundleName(logRecord.getResourceBundleName());
newRecord.setSequenceNumber(logRecord.getSequenceNumber());
newRecord.setSourceClassName(logRecord.getSourceClassName());
newRecord.setSourceMethodName(logRecord.getSourceMethodName());
newRecord.setLongThreadID(logRecord.getLongThreadID());
// Skip thrown
return newRecord;
}

public static void printLogProperties(Properties logProps, String prefix) {
if (logProps != null) {
for (String propName : logProps.stringPropertyNames()) {
System.err.println(prefix + propName + '=' + logProps.getProperty(propName));
}
}
}
}
Loading

0 comments on commit 45be11a

Please sign in to comment.