From f9f45e97d6bbdbf023b68e92f4cacaa2c49ff30f Mon Sep 17 00:00:00 2001 From: dshimo Date: Wed, 17 Apr 2024 16:13:00 -0500 Subject: [PATCH] getServerConfigDocument update --- .../maven/applications/DeployMojoSupport.java | 5 +---- .../tools/maven/applications/UndeployAppMojo.java | 5 +---- .../tools/maven/server/PluginConfigSupport.java | 14 ++++---------- 3 files changed, 6 insertions(+), 18 deletions(-) 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 8cc72e151..7a5e1fe64 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 @@ -308,14 +308,11 @@ protected void verifyAppStarted(String appFile) throws MojoExecutionException { if (shouldValidateAppStart()) { String appName = appFile.substring(0, appFile.lastIndexOf('.')); if (getAppsDirectory().equals("apps")) { - - File serverXML = new File(serverDirectory, "server.xml"); - try { Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); CommonLogger logger = new CommonLogger(getLog()); setLog(logger.getLog()); - getServerConfigDocument(logger, serverXML, libertyDirPropertyFiles); + getServerConfigDocument(logger, libertyDirPropertyFiles); //appName will be set to a name derived from appFile if no name can be found. appName = scd.findNameForLocation(appFile); 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 a26848824..27b5d940b 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 @@ -131,13 +131,10 @@ protected void undeployApp(File file) throws MojoExecutionException { if (getAppsDirectory().equals("apps")) { try { - File serverXML = new File(serverDirectory.getCanonicalPath(), "server.xml"); - Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); CommonLogger logger = new CommonLogger(getLog()); setLog(logger.getLog()); - getServerConfigDocument(logger, serverXML, configDirectory, - bootstrapPropertiesFile, combinedBootstrapProperties, serverEnvFile, false, libertyDirPropertyFiles); + getServerConfigDocument(logger, libertyDirPropertyFiles); //appName will be set to a name derived from file if no name can be found. appName = scd.findNameForLocation(appName); 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 dde260e6c..f4b322c5b 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 @@ -374,10 +374,7 @@ protected Set getAppConfigLocationsFromSourceServerXml() { Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles(); CommonLogger logger = new CommonLogger(getLog()); setLog(logger.getLog()); - // scd = getServerConfigDocument(logger, serverXML, configDirectory, - // bootstrapPropertiesFile, combinedBootstrapProperties, serverEnvFile, false, - // libertyDirPropertyFiles); - scd = getServerConfigDocument(logger, serverXML, libertyDirPropertyFiles); + scd = getServerConfigDocument(logger, libertyDirPropertyFiles); } catch (Exception e) { getLog().warn(e.getLocalizedMessage()); getLog().debug(e); @@ -386,6 +383,7 @@ protected Set getAppConfigLocationsFromSourceServerXml() { return scd != null ? scd.getLocations() : new HashSet(); } + // Deprecated after ci.common 1.8.33 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())) { @@ -395,12 +393,8 @@ protected ServerConfigDocument getServerConfigDocument(CommonLoggerI log, File s return scd; } - protected ServerConfigDocument getServerConfigDocument(CommonLoggerI log, File serverXML, Map libertyDirPropertyFiles) throws IOException { - if (scd == null || !scd.getServerXML().getCanonicalPath().equals(serverXML.getCanonicalPath())) { - scd = new ServerConfigDocument(log, libertyDirPropertyFiles); - } - - return scd; + protected ServerConfigDocument getServerConfigDocument(CommonLoggerI log, Map libertyDirPropertyFiles) throws IOException { + return new ServerConfigDocument(log, libertyDirPropertyFiles); } protected String getAppsDirectory() {