From e5da4d75aa0b483247e7a85f786769d1a38eba76 Mon Sep 17 00:00:00 2001 From: Cheryl King Date: Wed, 17 Jan 2024 15:12:34 -0600 Subject: [PATCH 1/3] Make thread safe --- .github/workflows/maven.yml | 5 +++-- liberty-maven-plugin/pom.xml | 2 +- .../tools/maven/applications/DeployMojo.java | 5 ++--- .../maven/applications/DeployMojoSupport.java | 12 ++++------- .../maven/applications/UndeployAppMojo.java | 9 ++++----- .../maven/server/PluginConfigSupport.java | 20 ++++++++++++++----- .../maven/server/StartDebugMojoSupport.java | 4 ++-- .../tools/maven/utils/CommonLogger.java | 19 ++---------------- 8 files changed, 33 insertions(+), 43 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 5c5bb1be0..e48781e1f 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -48,7 +48,8 @@ jobs: - name: Checkout ci.common uses: actions/checkout@v3 with: - repository: OpenLiberty/ci.common + repository: cherylking/ci.common + ref: makeThreadSafe path: ci.common - name: Checkout ci.ant uses: actions/checkout@v3 @@ -102,7 +103,7 @@ jobs: - name: Clone ci.ant, ci.common, ci.maven repos to C drive run: | cp -r D:/a/ci.maven/ci.maven C:/ci.maven - git clone https://github.com/OpenLiberty/ci.common.git C:/ci.common + git clone https://github.com/cherylking/ci.common.git --branch makeThreadSafe --single-branch C:/ci.common git clone https://github.com/OpenLiberty/ci.ant.git C:/ci.ant - name: Set up Maven uses: stCarolas/setup-maven@v4.5 diff --git a/liberty-maven-plugin/pom.xml b/liberty-maven-plugin/pom.xml index 4b3065125..c6c919883 100644 --- a/liberty-maven-plugin/pom.xml +++ b/liberty-maven-plugin/pom.xml @@ -88,7 +88,7 @@ io.openliberty.tools ci.common - 1.8.30 + 1.8.31-SNAPSHOT org.twdata.maven diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojo.java index b8425cbdb..335b1c258 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2014, 2023. + * (C) Copyright IBM Corporation 2014, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,6 @@ import io.openliberty.tools.maven.utils.SpringBootUtil; import io.openliberty.tools.common.plugins.config.ApplicationXmlDocument; import io.openliberty.tools.common.plugins.config.LooseConfigData; -import io.openliberty.tools.common.plugins.config.ServerConfigDocument; import io.openliberty.tools.common.plugins.util.DevUtil; /** @@ -304,7 +303,7 @@ private static LooseConfigData createLooseConfigData() throws MojoExecutionExcep private void cleanupPreviousExecution() { if (ApplicationXmlDocument.getApplicationXmlFile(serverDirectory).exists()) { ApplicationXmlDocument.getApplicationXmlFile(serverDirectory).delete(); - ServerConfigDocument.markInstanceStale(); + scd = null; // force reinitialization of ServerConfigDocument } } diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java index 7fc8222a8..ef15812f8 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojoSupport.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2016, 2023. + * (C) Copyright IBM Corporation 2016, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,12 +44,8 @@ import io.openliberty.tools.common.plugins.config.ApplicationXmlDocument; import io.openliberty.tools.common.plugins.config.LooseApplication; import io.openliberty.tools.common.plugins.config.LooseConfigData; -import io.openliberty.tools.common.plugins.config.ServerConfigDocument; import io.openliberty.tools.common.plugins.util.DevUtil; -import io.openliberty.tools.common.plugins.util.InstallFeatureUtil; -import io.openliberty.tools.common.plugins.util.InstallFeatureUtil.ProductProperties; import io.openliberty.tools.common.plugins.util.OSUtil; -import io.openliberty.tools.common.plugins.util.PluginExecutionException; /** * Support for installing and deploying applications to a Liberty server. @@ -317,13 +313,13 @@ protected void verifyAppStarted(String appFile) throws MojoExecutionException { try { Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); - CommonLogger logger = CommonLogger.getInstance(getLog()); + CommonLogger logger = new CommonLogger(getLog()); setLog(logger.getLog()); - ServerConfigDocument.getInstance(logger, serverXML, configDirectory, + getServerConfigDocument(logger, serverXML, configDirectory, bootstrapPropertiesFile, combinedBootstrapProperties, serverEnvFile, false, libertyDirPropertyFiles); //appName will be set to a name derived from appFile if no name can be found. - appName = ServerConfigDocument.findNameForLocation(appFile); + appName = scd.findNameForLocation(appFile); } catch (Exception e) { getLog().warn(e.getLocalizedMessage()); getLog().debug(e); diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java index 3d303acf1..036fe8111 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2014, 2023. + * (C) Copyright IBM Corporation 2014, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ import org.apache.maven.project.MavenProject; import io.openliberty.tools.ant.ServerTask; -import io.openliberty.tools.common.plugins.config.ServerConfigDocument; import io.openliberty.tools.maven.utils.CommonLogger; /** @@ -135,13 +134,13 @@ protected void undeployApp(File file) throws MojoExecutionException { File serverXML = new File(serverDirectory.getCanonicalPath(), "server.xml"); Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); - CommonLogger logger = CommonLogger.getInstance(getLog()); + CommonLogger logger = new CommonLogger(getLog()); setLog(logger.getLog()); - ServerConfigDocument.getInstance(logger, serverXML, configDirectory, + getServerConfigDocument(logger, serverXML, configDirectory, bootstrapPropertiesFile, combinedBootstrapProperties, serverEnvFile, false, libertyDirPropertyFiles); //appName will be set to a name derived from file if no name can be found. - appName = ServerConfigDocument.findNameForLocation(appName); + appName = scd.findNameForLocation(appName); } catch (Exception e) { getLog().warn(e.getLocalizedMessage()); } diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java index 13af4401d..c23253872 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PluginConfigSupport.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2017, 2023. + * (C) Copyright IBM Corporation 2017, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,7 @@ import io.openliberty.tools.maven.PluginConfigXmlDocument; import io.openliberty.tools.maven.utils.CommonLogger; +import io.openliberty.tools.common.CommonLoggerI; import io.openliberty.tools.common.plugins.config.ApplicationXmlDocument; import io.openliberty.tools.common.plugins.config.ServerConfigDocument; @@ -47,6 +48,8 @@ */ public abstract class PluginConfigSupport extends StartDebugMojoSupport { + protected ServerConfigDocument scd = null; + /** * Application directory. */ @@ -325,16 +328,14 @@ protected boolean isAnyAppConfiguredInSourceServerXml() { protected Set getAppConfigLocationsFromSourceServerXml() { - ServerConfigDocument scd = null; - File serverXML = new File(serverDirectory, "server.xml"); if (serverXML != null && serverXML.exists()) { try { Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); - CommonLogger logger = CommonLogger.getInstance(getLog()); + CommonLogger logger = new CommonLogger(getLog()); setLog(logger.getLog()); - scd = ServerConfigDocument.getInstance(logger, serverXML, configDirectory, + scd = getServerConfigDocument(logger, serverXML, configDirectory, bootstrapPropertiesFile, combinedBootstrapProperties, serverEnvFile, false, libertyDirPropertyFiles); } catch (Exception e) { @@ -345,6 +346,15 @@ protected Set getAppConfigLocationsFromSourceServerXml() { return scd != null ? scd.getLocations() : new HashSet(); } + protected ServerConfigDocument getServerConfigDocument(CommonLoggerI log, File serverXML, File configDir, File bootstrapFile, + Map bootstrapProp, File serverEnvFile, boolean giveConfigDirPrecedence, Map libertyDirPropertyFiles) throws IOException { + if (scd == null || !scd.getServerXML().getCanonicalPath().equals(serverXML.getCanonicalPath())) { + scd = new ServerConfigDocument(log, serverXML, configDir, bootstrapFile, bootstrapProp, serverEnvFile, giveConfigDirPrecedence, libertyDirPropertyFiles); + } + + return scd; + } + protected String getAppsDirectory() { return getAppsDirectory(true); } diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StartDebugMojoSupport.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StartDebugMojoSupport.java index 442b2a06f..224b54a90 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StartDebugMojoSupport.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StartDebugMojoSupport.java @@ -85,7 +85,7 @@ public abstract class StartDebugMojoSupport extends ServerFeatureSupport { private static final String LATE_PROP_RESOLUTION_SYNTAX = "@\\{(.+?)\\}"; private static final Pattern LATE_PROP_PATTERN = Pattern.compile(LATE_PROP_RESOLUTION_SYNTAX); - private static boolean configFilesCopied = false; + private boolean configFilesCopied = false; protected final String PLUGIN_VARIABLE_CONFIG_OVERRIDES_XML = "configDropins/overrides/liberty-plugin-variable-config.xml"; protected final String PLUGIN_VARIABLE_CONFIG_DEFAULTS_XML = "configDropins/defaults/liberty-plugin-variable-config.xml"; @@ -1030,7 +1030,7 @@ private void makeParentDirectory(File file) { } } - public static boolean isConfigCopied() { + public boolean isConfigCopied() { return configFilesCopied; } diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/CommonLogger.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/CommonLogger.java index 65a9552d8..6e5a44bf9 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/CommonLogger.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/utils/CommonLogger.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2019, 2023. + * (C) Copyright IBM Corporation 2019, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,24 +22,9 @@ public class CommonLogger implements CommonLoggerI { - private static CommonLogger logger = null; private Log loggerImpl; - public static CommonLogger getInstance(Log mojoLogger) { - if (logger == null) { - logger = new CommonLogger(mojoLogger); - } else { - logger.setLogger(mojoLogger); - } - - return logger; - } - - private CommonLogger(Log mojoLogger) { - loggerImpl = mojoLogger; - } - - private void setLogger(Log mojoLogger) { + public CommonLogger(Log mojoLogger) { loggerImpl = mojoLogger; } From 9389e2ce23d5ba4083751754123b994f77cc80fe Mon Sep 17 00:00:00 2001 From: Cheryl King Date: Wed, 17 Jan 2024 16:06:59 -0600 Subject: [PATCH 2/3] Add threadSafe attribute to @Mojo annotations --- .../net/wasdev/wlp/test/dev/it/BaseGenerateFeaturesTest.java | 5 ++++- .../io/openliberty/tools/maven/applications/DeployMojo.java | 2 +- .../openliberty/tools/maven/applications/DisplayUrlMojo.java | 4 ++-- .../tools/maven/applications/UndeployAppMojo.java | 2 +- .../maven/extensions/arquillian/ConfigureArquillianMojo.java | 4 ++-- .../java/io/openliberty/tools/maven/jsp/CompileJspMojo.java | 4 ++-- .../io/openliberty/tools/maven/server/CheckStatusMojo.java | 4 ++-- .../io/openliberty/tools/maven/server/CleanServerMojo.java | 4 ++-- .../io/openliberty/tools/maven/server/CreateServerMojo.java | 4 ++-- .../io/openliberty/tools/maven/server/DebugServerMojo.java | 4 ++-- .../main/java/io/openliberty/tools/maven/server/DevMojo.java | 4 ++-- .../java/io/openliberty/tools/maven/server/DevcMojo.java | 4 ++-- .../io/openliberty/tools/maven/server/DumpServerMojo.java | 4 ++-- .../openliberty/tools/maven/server/GenerateFeaturesMojo.java | 4 ++-- .../openliberty/tools/maven/server/InstallFeatureMojo.java | 4 ++-- .../io/openliberty/tools/maven/server/InstallServerMojo.java | 4 ++-- .../openliberty/tools/maven/server/JavaDumpServerMojo.java | 4 ++-- .../io/openliberty/tools/maven/server/PackageServerMojo.java | 4 ++-- .../openliberty/tools/maven/server/PrepareFeatureMojo.java | 4 ++-- .../io/openliberty/tools/maven/server/RunServerMojo.java | 4 ++-- .../io/openliberty/tools/maven/server/StartServerMojo.java | 4 ++-- .../io/openliberty/tools/maven/server/StopServerMojo.java | 4 ++-- .../openliberty/tools/maven/server/TestStartServerMojo.java | 4 ++-- .../openliberty/tools/maven/server/TestStopServerMojo.java | 4 ++-- .../openliberty/tools/maven/server/UninstallFeatureMojo.java | 4 ++-- 25 files changed, 50 insertions(+), 47 deletions(-) diff --git a/liberty-maven-plugin/src/it/generate-features-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseGenerateFeaturesTest.java b/liberty-maven-plugin/src/it/generate-features-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseGenerateFeaturesTest.java index 01ac7c835..0fc995b28 100644 --- a/liberty-maven-plugin/src/it/generate-features-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseGenerateFeaturesTest.java +++ b/liberty-maven-plugin/src/it/generate-features-it/src/test/java/net/wasdev/wlp/test/dev/it/BaseGenerateFeaturesTest.java @@ -116,7 +116,10 @@ protected static void runProcess(String processCommand) throws IOException, Inte writer = new BufferedWriter(new OutputStreamWriter(stdin)); // wait for process to finish max 20 seconds process.waitFor(20, TimeUnit.SECONDS); - assertFalse(process.isAlive()); + if (process.isAlive()) { + process.waitFor(20, TimeUnit.SECONDS); + } + assertFalse("The process for command "+command+" did not finish in 40 seconds.", process.isAlive()); // save and print process output Path path = logFile.toPath(); diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojo.java index 335b1c258..faace6f06 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DeployMojo.java @@ -44,7 +44,7 @@ * dependencies with scope compile + system + runtime. * Provided scope transitive dependencies are not included by default (built-in maven behavior). */ -@Mojo(name = "deploy", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) +@Mojo(name = "deploy", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true) public class DeployMojo extends DeployMojoSupport { @Override diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DisplayUrlMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DisplayUrlMojo.java index c61c11149..0d9f2ae42 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DisplayUrlMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/DisplayUrlMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2017, 2023. + * (C) Copyright IBM Corporation 2017, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ /** * Display an application URL in the default browser. */ -@Mojo(name = "display-url") +@Mojo(name = "display-url", threadSafe = true) public class DisplayUrlMojo extends AbstractMojo { /** diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java index 036fe8111..a26848824 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/applications/UndeployAppMojo.java @@ -33,7 +33,7 @@ * Undeploy application from liberty server. If no parameters have been defined * the mojo will undeploy all applications from the server. */ -@Mojo(name = "undeploy", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) +@Mojo(name = "undeploy", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true) public class UndeployAppMojo extends DeployMojoSupport { diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/extensions/arquillian/ConfigureArquillianMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/extensions/arquillian/ConfigureArquillianMojo.java index bea75f7ff..9a4fe0222 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/extensions/arquillian/ConfigureArquillianMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/extensions/arquillian/ConfigureArquillianMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2017, 2023. + * (C) Copyright IBM Corporation 2017, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ import io.openliberty.tools.common.arquillian.util.Constants; import io.openliberty.tools.common.arquillian.util.HttpPortUtil; -@Mojo(name = "configure-arquillian", requiresDependencyResolution = ResolutionScope.TEST) +@Mojo(name = "configure-arquillian", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true) public class ConfigureArquillianMojo extends BasicSupport { @Parameter diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/jsp/CompileJspMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/jsp/CompileJspMojo.java index 8a847f4b3..92c523d77 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/jsp/CompileJspMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/jsp/CompileJspMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2017, 2023. + * (C) Copyright IBM Corporation 2017, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,7 +37,7 @@ /** * Compile the JSPs in the src/main/webapp folder. */ -@Mojo(name = "compile-jsp", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE) +@Mojo(name = "compile-jsp", defaultPhase = LifecyclePhase.COMPILE, requiresDependencyResolution = ResolutionScope.COMPILE, threadSafe = true) public class CompileJspMojo extends InstallFeatureSupport { /** diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/CheckStatusMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/CheckStatusMojo.java index bc98db5f9..943e1afe0 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/CheckStatusMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/CheckStatusMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2014, 2023. + * (C) Copyright IBM Corporation 2014, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ /** * Check a liberty server status */ -@Mojo(name = "status") +@Mojo(name = "status", threadSafe = true) public class CheckStatusMojo extends StartDebugMojoSupport { @Override diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/CleanServerMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/CleanServerMojo.java index 1ea3e4a09..c4de9201e 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/CleanServerMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/CleanServerMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2016, 2023. + * (C) Copyright IBM Corporation 2016, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ /** * Clean the logs, workarea, dropins and apps directories. */ -@Mojo(name = "clean") +@Mojo(name = "clean", threadSafe = true) public class CleanServerMojo extends StartDebugMojoSupport { /** diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/CreateServerMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/CreateServerMojo.java index 0ad3981eb..1303f7f1a 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/CreateServerMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/CreateServerMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2014, 2023. + * (C) Copyright IBM Corporation 2014, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ /** * Create a liberty server */ -@Mojo(name = "create", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) +@Mojo(name = "create", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true) public class CreateServerMojo extends PluginConfigSupport { /** diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DebugServerMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DebugServerMojo.java index 20bee2433..c4d36f19c 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DebugServerMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DebugServerMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2017, 2023. + * (C) Copyright IBM Corporation 2017, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ /** * Start a liberty server in debug mode */ -@Mojo(name = "debug", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) +@Mojo(name = "debug", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true) public class DebugServerMojo extends StartDebugMojoSupport { diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java index ba7c31072..45e5a15d4 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2019, 2023. + * (C) Copyright IBM Corporation 2019, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,7 +83,7 @@ * Start a liberty server in dev mode import to set ResolutionScope for TEST as * it helps build full transitive dependency classpath */ -@Mojo(name = "dev", requiresDependencyCollection = ResolutionScope.TEST, requiresDependencyResolution = ResolutionScope.TEST) +@Mojo(name = "dev", requiresDependencyCollection = ResolutionScope.TEST, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true) public class DevMojo extends LooseAppSupport { private static final String TEST_RUN_ID_PROPERTY_NAME = "liberty.dev.test.run.id"; diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevcMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevcMojo.java index 84d488486..c81afaa63 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevcMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DevcMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2020, 2023. + * (C) Copyright IBM Corporation 2020, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ /** * Start dev mode for containers */ -@Mojo(name = "devc", requiresDependencyCollection = ResolutionScope.TEST, requiresDependencyResolution = ResolutionScope.TEST) +@Mojo(name = "devc", requiresDependencyCollection = ResolutionScope.TEST, requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true) public class DevcMojo extends DevMojo { @Override diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DumpServerMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DumpServerMojo.java index 7a60ca71d..677f90a57 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DumpServerMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/DumpServerMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2014, 2023. + * (C) Copyright IBM Corporation 2014, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ /** * Dump diagnostic information from the server into an archive. */ -@Mojo(name = "dump", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) +@Mojo(name = "dump", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true) public class DumpServerMojo extends StartDebugMojoSupport { /** diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/GenerateFeaturesMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/GenerateFeaturesMojo.java index d021a45a5..7e5fe9fac 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/GenerateFeaturesMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/GenerateFeaturesMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2021, 2023. + * (C) Copyright IBM Corporation 2021, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -53,7 +53,7 @@ * them in a new featureManager element in a new XML file in the source * config/dropins directory. */ -@Mojo(name = "generate-features") +@Mojo(name = "generate-features", threadSafe = true) public class GenerateFeaturesMojo extends ServerFeatureSupport { public static final String FEATURES_FILE_MESSAGE = "The Liberty Maven Plugin has generated Liberty features necessary for your application in " diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/InstallFeatureMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/InstallFeatureMojo.java index b8691a9da..d651d5c81 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/InstallFeatureMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/InstallFeatureMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2015, 2023. + * (C) Copyright IBM Corporation 2015, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -39,7 +39,7 @@ * This mojo installs a feature packaged as a Subsystem Archive (esa) to the * runtime. */ -@Mojo(name = "install-feature") +@Mojo(name = "install-feature", threadSafe = true) public class InstallFeatureMojo extends InstallFeatureSupport { /** diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/InstallServerMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/InstallServerMojo.java index 4325a6cf7..98c506846 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/InstallServerMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/InstallServerMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2014, 2023. + * (C) Copyright IBM Corporation 2014, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ /** * Install a liberty server */ -@Mojo(name = "install-server", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) +@Mojo(name = "install-server", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true) public class InstallServerMojo extends PluginConfigSupport { @Override diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/JavaDumpServerMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/JavaDumpServerMojo.java index 3f44d1060..4e3186ab9 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/JavaDumpServerMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/JavaDumpServerMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2014, 2023. + * (C) Copyright IBM Corporation 2014, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ /** * Dump diagnostic information from the server JVM. */ -@Mojo(name = "java-dump", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) +@Mojo(name = "java-dump", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true) public class JavaDumpServerMojo extends StartDebugMojoSupport { /** diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PackageServerMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PackageServerMojo.java index 4c5338362..c94cf6821 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PackageServerMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PackageServerMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2014, 2023. + * (C) Copyright IBM Corporation 2014, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ /** * Package a liberty server */ -@Mojo(name = "package", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) +@Mojo(name = "package", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true) public class PackageServerMojo extends StartDebugMojoSupport { private enum PackageFileType { diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PrepareFeatureMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PrepareFeatureMojo.java index e00e86229..ac4b15ac4 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PrepareFeatureMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/PrepareFeatureMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2021, 2023. + * (C) Copyright IBM Corporation 2021, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -31,7 +31,7 @@ * This mojo generates JSON files so user features can be installed * from a specified BOM */ -@Mojo(name = "prepare-feature") +@Mojo(name = "prepare-feature", threadSafe = true) public class PrepareFeatureMojo extends PrepareFeatureSupport { @Override diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/RunServerMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/RunServerMojo.java index 9cb34a58b..d8b39a446 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/RunServerMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/RunServerMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2014, 2023. + * (C) Copyright IBM Corporation 2014, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ /** * Start a liberty server */ -@Mojo(name = "run", requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) +@Mojo(name = "run", requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true) public class RunServerMojo extends PluginConfigSupport { /** diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StartServerMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StartServerMojo.java index 5fbeaee67..b3e5bb60f 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StartServerMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StartServerMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2014, 2023. + * (C) Copyright IBM Corporation 2014, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ /** * Start a liberty server */ -@Mojo(name = "start", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) +@Mojo(name = "start", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true) public class StartServerMojo extends StartDebugMojoSupport { diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StopServerMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StopServerMojo.java index 854a64f45..b833a7262 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StopServerMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/StopServerMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2014, 2023. + * (C) Copyright IBM Corporation 2014, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ /** * Stop a liberty server */ -@Mojo(name = "stop") +@Mojo(name = "stop", threadSafe = true) public class StopServerMojo extends StartDebugMojoSupport { /** diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/TestStartServerMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/TestStartServerMojo.java index 4a1e4ed82..8deae477f 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/TestStartServerMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/TestStartServerMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2017, 2019. + * (C) Copyright IBM Corporation 2017, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ /** * Start a liberty server if tests are not skipped */ -@Mojo(name = "test-start") +@Mojo(name = "test-start", threadSafe = true) public class TestStartServerMojo extends StartServerMojo { diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/TestStopServerMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/TestStopServerMojo.java index 257943cc1..b882a2faf 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/TestStopServerMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/TestStopServerMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2017, 2019. + * (C) Copyright IBM Corporation 2017, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ /** * Quickly bypass stopping server if server isn't started */ -@Mojo(name = "test-stop") +@Mojo(name = "test-stop", threadSafe = true) public class TestStopServerMojo extends StopServerMojo { diff --git a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/UninstallFeatureMojo.java b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/UninstallFeatureMojo.java index 697d07855..acecb89c5 100644 --- a/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/UninstallFeatureMojo.java +++ b/liberty-maven-plugin/src/main/java/io/openliberty/tools/maven/server/UninstallFeatureMojo.java @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corporation 2015, 2020. + * (C) Copyright IBM Corporation 2015, 2024. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of @@ -34,7 +34,7 @@ * This mojo uninstalls a feature packaged as a Subsystem Archive (esa) from the * runtime. */ -@Mojo(name = "uninstall-feature") +@Mojo(name = "uninstall-feature", threadSafe = true) public class UninstallFeatureMojo extends BasicSupport { From 8c5b19242def12002c7ac62516d9b2d4fcec773d Mon Sep 17 00:00:00 2001 From: Cheryl King Date: Thu, 18 Jan 2024 12:51:49 -0600 Subject: [PATCH 3/3] Remove temp yaml changes --- .github/workflows/maven.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index e48781e1f..5c5bb1be0 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -48,8 +48,7 @@ jobs: - name: Checkout ci.common uses: actions/checkout@v3 with: - repository: cherylking/ci.common - ref: makeThreadSafe + repository: OpenLiberty/ci.common path: ci.common - name: Checkout ci.ant uses: actions/checkout@v3 @@ -103,7 +102,7 @@ jobs: - name: Clone ci.ant, ci.common, ci.maven repos to C drive run: | cp -r D:/a/ci.maven/ci.maven C:/ci.maven - git clone https://github.com/cherylking/ci.common.git --branch makeThreadSafe --single-branch C:/ci.common + git clone https://github.com/OpenLiberty/ci.common.git C:/ci.common git clone https://github.com/OpenLiberty/ci.ant.git C:/ci.ant - name: Set up Maven uses: stCarolas/setup-maven@v4.5