diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 2e2ca70a7..0e350e321 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -48,8 +48,9 @@ jobs:
- name: Checkout ci.common
uses: actions/checkout@v3
with:
- repository: OpenLiberty/ci.common
+ repository: arunvenmany-ibm/ci.common
path: ci.common
+ ref: spring-boot-application-node-bug-fix
- name: Checkout ci.ant
uses: actions/checkout@v3
with:
@@ -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/arunvenmany-ibm/ci.common.git --branch spring-boot-application-node-bug-fix --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/src/it/springboot-3-deploy-multiple-springboot-application-nodes-fail-it/invoker.properties b/liberty-maven-plugin/src/it/springboot-3-deploy-multiple-springboot-application-nodes-fail-it/invoker.properties
new file mode 100644
index 000000000..62359c56d
--- /dev/null
+++ b/liberty-maven-plugin/src/it/springboot-3-deploy-multiple-springboot-application-nodes-fail-it/invoker.properties
@@ -0,0 +1 @@
+invoker.buildResult = failure
\ No newline at end of file
diff --git a/liberty-maven-plugin/src/it/springboot-3-deploy-multiple-springboot-application-nodes-fail-it/pom.xml b/liberty-maven-plugin/src/it/springboot-3-deploy-multiple-springboot-application-nodes-fail-it/pom.xml
new file mode 100644
index 000000000..79ed0f87a
--- /dev/null
+++ b/liberty-maven-plugin/src/it/springboot-3-deploy-multiple-springboot-application-nodes-fail-it/pom.xml
@@ -0,0 +1,128 @@
+
+
+
+ 4.0.0
+
+
+ io.openliberty.tools.it
+ tests
+ 1.0-SNAPSHOT
+
+
+ springboot-3-deploy-multiple-springboot-application-nodes-fail-it
+ jar
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ junit
+ junit
+ 4.13.1
+ test
+
+
+
+ commons-io
+ commons-io
+ 2.14.0
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ exec
+
+
+
+ io.openliberty.tools
+ liberty-maven-plugin
+ @pom.version@
+
+
+ ${runtimeGroupId}
+ ${runtimeKernelId}
+ ${runtimeVersion}
+ zip
+
+ test
+ src/test/resources/server.xml
+
+
+
+ install-liberty-server
+ compile
+
+ install-server
+
+
+
+ create-server
+ pre-integration-test
+
+ create
+
+
+
+ install-feature
+ pre-integration-test
+
+ install-feature
+
+
+
+ true
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+ 3.1.2
+
+ ${project.build.directory}
+ -enableassertions
+
+
+
+ integration-test
+
+ integration-test
+
+
+
+ verify
+ verify
+
+ verify
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.1.2
+
+ true
+
+
+
+
+
+
diff --git a/liberty-maven-plugin/src/it/springboot-3-deploy-multiple-springboot-application-nodes-fail-it/src/test/resources/server.xml b/liberty-maven-plugin/src/it/springboot-3-deploy-multiple-springboot-application-nodes-fail-it/src/test/resources/server.xml
new file mode 100644
index 000000000..5976a6b36
--- /dev/null
+++ b/liberty-maven-plugin/src/it/springboot-3-deploy-multiple-springboot-application-nodes-fail-it/src/test/resources/server.xml
@@ -0,0 +1,7 @@
+
+
+ appSecurityClient-1.0
+ jaxws
+ badname
+
+
diff --git a/liberty-maven-plugin/src/it/springboot-3-tests/pom.xml b/liberty-maven-plugin/src/it/springboot-3-tests/pom.xml
index 321abfb93..ca7221929 100644
--- a/liberty-maven-plugin/src/it/springboot-3-tests/pom.xml
+++ b/liberty-maven-plugin/src/it/springboot-3-tests/pom.xml
@@ -25,6 +25,7 @@
springboot-3-appsdirectory-apps-it
springboot-3-appsdirectory-dropins-it
+ springboot-3-appsdirectory-server-xml-springboot-node-it
\ No newline at end of file
diff --git a/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-apps-it/src/test/java/application/InstallSpringBoot30AppIT.java b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-apps-it/src/test/java/application/InstallSpringBoot30AppIT.java
index 2525e2121..a8717c8e5 100644
--- a/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-apps-it/src/test/java/application/InstallSpringBoot30AppIT.java
+++ b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-apps-it/src/test/java/application/InstallSpringBoot30AppIT.java
@@ -27,6 +27,9 @@ public void testThinApplicationExistsInAppsDirectory() throws Exception {
File f = new File("target/liberty/wlp/usr/servers/test/apps/thin-springboot-3-appsdirectory-apps-it-1.0.0.Final-exec.jar");
assertTrue(f.getCanonicalFile() + " doesn't exist. Plugin failed to place the file at right destination.", f.exists());
+ File f2 = new File("target/liberty/wlp/usr/servers/test/configDropins/defaults");
+ assertTrue(f2.getCanonicalFile() + " folder doesn't exist. Plugin failed to create the config dropins folder ", f2.exists());
+ assertTrue(f2.getCanonicalFile() + " folder doesn't contain any files. Plugin failed to place config xml at right destination.", f2.list().length == 1);
}
@Test
diff --git a/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/pom.xml b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/pom.xml
new file mode 100644
index 000000000..382f864b0
--- /dev/null
+++ b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/pom.xml
@@ -0,0 +1,172 @@
+
+
+ 4.0.0
+
+ springboot-3-appsdirectory-server-xml-springboot-node-it
+ 1.0.0.Final
+ jar
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 3.1.3
+
+
+
+
+ UTF-8
+ UTF-8
+ 17
+ 17
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ junit
+ junit
+ 4.13.2
+ test
+
+
+
+ javax.xml.bind
+ jaxb-api
+ 2.3.1
+ provided
+
+
+ com.sun.xml.bind
+ jaxb-core
+ 2.3.0.1
+ provided
+
+
+ javax.activation
+ activation
+ 1.1.1
+ provided
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ exec
+
+
+
+
+ io.openliberty.tools
+ liberty-maven-plugin
+ @pom.version@
+
+
+
+ test
+ src/test/resources/server.xml
+
+ com.ibm.websphere.appserver.runtime
+ wlp-jakartaee10
+ 23.0.0.10
+ zip
+
+ apps
+ spring-boot-project
+
+
+
+
+ stop-server-before-clean
+ pre-clean
+
+ stop
+
+
+
+ create-server
+ prepare-package
+
+ install-server
+ create
+ install-feature
+
+
+
+ install-apps
+ package
+
+ deploy
+
+
+
+ test-start-server
+ pre-integration-test
+
+ test-start
+
+
+
+ test-stop-server
+ post-integration-test
+
+ test-stop
+
+
+
+
+
+
+ maven-failsafe-plugin
+ 3.1.2
+
+ alphabetical
+ true
+ 1
+ true
+ 2400
+ -enableassertions
+ ${project.build.directory}
+
+ **/*IT.java
+
+
+ @pom.version@
+ ${runtimeVersion}
+
+ false
+
+
+
+ default-integration-test
+ integration-test
+
+ integration-test
+
+
+
+ default-verify
+ verify
+
+ verify
+
+
+
+
+
+
+
+
diff --git a/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/main/java/application/SpringBootApp.java b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/main/java/application/SpringBootApp.java
new file mode 100644
index 000000000..9f9029199
--- /dev/null
+++ b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/main/java/application/SpringBootApp.java
@@ -0,0 +1,35 @@
+/**
+ * (C) Copyright IBM Corporation 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 the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package application;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@SpringBootApplication
+@RestController
+public class SpringBootApp {
+ public static void main(String[] args) {
+ SpringApplication.run(SpringBootApp.class, args);
+ }
+
+ @RequestMapping("/spring")
+ public String hello() {
+ return "HELLO SPRING BOOT!!";
+ }
+}
\ No newline at end of file
diff --git a/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/main/liberty/config/server.xml b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/main/liberty/config/server.xml
new file mode 100644
index 000000000..f11486400
--- /dev/null
+++ b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/main/liberty/config/server.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+ servlet-6.0
+
+
+ springBoot-3.0
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/test/java/application/InstallSpringBoot30AppIT.java b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/test/java/application/InstallSpringBoot30AppIT.java
new file mode 100644
index 000000000..27ca0137b
--- /dev/null
+++ b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/test/java/application/InstallSpringBoot30AppIT.java
@@ -0,0 +1,37 @@
+/**
+ * (C) Copyright IBM Corporation 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 the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package application;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import org.junit.Test;
+
+public class InstallSpringBoot30AppIT {
+
+ @Test
+ public void testThinApplicationExistsInAppsDirectory() throws Exception {
+
+ File f = new File("target/liberty/wlp/usr/servers/test/apps/thin-springboot-3-appsdirectory-apps-it-1.0.0.Final-exec.jar");
+ assertTrue(f.getCanonicalFile() + " doesn't exist. Plugin failed to place the file at right destination.", f.exists());
+ }
+
+ @Test
+ public void testLibIndexCacheExists() throws Exception {
+ File f = new File("target/liberty/wlp/usr/shared/resources/lib.index.cache");
+ assertTrue(f.getCanonicalFile()+ " doesn't exist. Plugin failed to place the cache directory at right destination.", f.exists());
+ }
+}
\ No newline at end of file
diff --git a/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/test/java/application/SpringBoot30RestEndpointIT.java b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/test/java/application/SpringBoot30RestEndpointIT.java
new file mode 100644
index 000000000..bb3a53c35
--- /dev/null
+++ b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/test/java/application/SpringBoot30RestEndpointIT.java
@@ -0,0 +1,49 @@
+/**
+ * (C) Copyright IBM Corporation 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 the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package application;
+
+import static org.junit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import org.junit.Test;
+
+public class SpringBoot30RestEndpointIT {
+
+ @Test
+ public void testSpringRestBootEndpoint() throws Exception {
+
+ URL requestUrl = new URL("http://localhost:9080/spring/");
+ HttpURLConnection conn = (HttpURLConnection) requestUrl.openConnection();
+
+ if (conn != null) {
+ assertEquals("Expected response code not found.", 200, conn.getResponseCode());
+ }
+
+ StringBuffer response = new StringBuffer();
+
+ try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {
+ String line;
+ while ((line = in.readLine()) != null) {
+ response.append(line);
+ }
+ }
+ assertEquals("Expected body not found.", "HELLO SPRING BOOT!!", response.toString());
+ }
+}
\ No newline at end of file
diff --git a/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/test/resources/server.xml b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/test/resources/server.xml
new file mode 100644
index 000000000..790a7c85a
--- /dev/null
+++ b/liberty-maven-plugin/src/it/springboot-3-tests/springboot-3-appsdirectory-server-xml-springboot-node-it/src/test/resources/server.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+ springBoot-3.0
+ servlet-6.0
+
+
+
+
+
\ No newline at end of file
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 a8c48d9fb..a7f487870 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
@@ -20,11 +20,13 @@
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
+import io.openliberty.tools.maven.utils.CommonLogger;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.MojoExecutionException;
@@ -114,8 +116,14 @@ private void installSpringBootApp() throws MojoExecutionException, IOException {
}
File fatArchiveSrc = SpringBootUtil.getSpringBootUberJAR(project, getLog());
-
- // Check if the archiveSrc is executable and then invokeSpringUtilCommand.
+ File serverXML = new File(serverDirectory, "server.xml");
+
+ Map libertyDirPropertyFiles = getLibertyDirectoryPropertyFiles();
+ CommonLogger logger = new CommonLogger(getLog());
+ setLog(logger.getLog());
+ getServerConfigDocument(logger, serverXML, libertyDirPropertyFiles);
+
+ // Check if the archiveSrc is executable and then invokeSpringUtilCommand.
if (io.openliberty.tools.common.plugins.util.SpringBootUtil.isSpringBootUberJar(fatArchiveSrc)) {
File thinArchiveTarget = getThinArchiveTarget(fatArchiveSrc);
File libIndexCacheTarget = getLibIndexCacheTarget();
@@ -144,11 +152,16 @@ private File getThinArchiveTarget(File archiveSrc) {
appsDir = new File(rootDirectory, appsDirName);
} else if ("dropins".equals(appsDirName)) {
appsDir = new File(rootDirectory, appsDirName+"/spring");
- }
- archiveTarget = new File(appsDir, "thin-" + archiveSrc.getName());
+ }
+
+ if (scd != null && scd.getSpringBootAppNodeLocation().isPresent()) {
+ archiveTarget = new File(appsDir, scd.getSpringBootAppNodeLocation().get());
+ } else {
+ archiveTarget = new File(appsDir, "thin-" + archiveSrc.getName());
+ }
return archiveTarget;
}
-
+
private File getLibIndexCacheTarget() {
// Set shared directory ${installDirectory}/usr/shared/
File sharedDirectory = new File(userDirectory, "shared");
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 191b9140c..4ba41602c 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
@@ -26,6 +26,7 @@
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
+import io.openliberty.tools.common.plugins.util.PluginExecutionException;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Profile;
import org.apache.maven.plugin.MojoExecutionException;
@@ -383,9 +384,13 @@ protected Set getAppConfigLocationsFromSourceServerXml() {
return scd != null ? scd.getLocations() : new HashSet();
}
- protected ServerConfigDocument getServerConfigDocument(CommonLoggerI log, File serverXML, Map libertyDirPropertyFiles) throws IOException {
+ protected ServerConfigDocument getServerConfigDocument(CommonLoggerI log, File serverXML, Map libertyDirPropertyFiles) throws IOException, MojoExecutionException {
if (scd == null || !scd.getOriginalServerXMLFile().getCanonicalPath().equals(serverXML.getCanonicalPath())) {
- scd = new ServerConfigDocument(log, serverXML, libertyDirPropertyFiles);
+ try {
+ scd = new ServerConfigDocument(log, serverXML, libertyDirPropertyFiles);
+ } catch (PluginExecutionException e) {
+ throw new MojoExecutionException(e.getMessage());
+ }
}
return scd;
diff --git a/liberty-maven-plugin/src/test/resources/checkErrorVersionlessFeature.bsh b/liberty-maven-plugin/src/test/resources/checkErrorVersionlessFeature.bsh
index b4f56ecd0..d2ab7ce69 100644
--- a/liberty-maven-plugin/src/test/resources/checkErrorVersionlessFeature.bsh
+++ b/liberty-maven-plugin/src/test/resources/checkErrorVersionlessFeature.bsh
@@ -9,6 +9,9 @@ switch (testname) {
case "kernel-install-versionless-feature-fail-no-platform-it":
expectedMessage = "CWWKF1516E: The platform could not be determined. The following versionless features cannot be installed: [servlet]";
break;
+ case "springboot-3-deploy-multiple-springboot-application-nodes-fail-it":
+ expectedMessage = "Found multiple springBootApplication elements specified in the server configuration. Only one springBootApplication can be configured per Liberty server.";
+ break;
default:
return false;
}