Skip to content

Commit

Permalink
Merge pull request #928 from arunvenmany-ibm/springboot_multi_node_fix
Browse files Browse the repository at this point in the history
changes for springbootappplication nodes in multiple config files
  • Loading branch information
arunvenmany-ibm authored Jan 13, 2025
2 parents 484b2e7 + 7833806 commit 8ec4372
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ compileTestGroovy {
}

def libertyAntVersion = "1.9.16"
def libertyCommonVersion = "1.8.36"
def libertyCommonVersion = "1.8.37-SNAPSHOT"

dependencies {
implementation gradleApi()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,18 @@ public class TestSpringBootApplication30 extends AbstractIntegrationTest{
try {
BuildResult result = runTasksFailResult(buildDir, 'deploy', 'libertyStart')
String output = result.getOutput()
assertTrue(output.contains("Found multiple springBootApplication elements specified in the server configuration. Only one springBootApplication can be configured per Liberty server."))
assertTrue(output.contains("Found multiple springBootApplication elements specified in the server configuration file"))
} catch (Exception e) {
throw new AssertionError ("Fail on task deploy.", e)
}
}

@Test
public void test_spring_boot_with_springbootapplication_nodes_apps_include_30() {
try {
BuildResult result = runTasksFailResult(buildDir, 'deploy', 'libertyStart')
String output = result.getOutput()
assertTrue(output.contains("Found multiple springBootApplication elements specified in the server configuration in files"))
} catch (Exception e) {
throw new AssertionError ("Fail on task deploy.", e)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">

<featureManager>
<!-- tag::servlet[] -->
<feature>servlet-6.0</feature>
<!-- end::servlet[] -->
<!-- tag::springboot[] -->
<feature>springBoot-3.0</feature>
<!-- end::springboot[] -->
</featureManager>

<!-- tag::httpport[] -->
<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="9080"
httpsPort="9443" />
<!-- end::httpport[] -->
<include location="${server.config.dir}/included_server.xml"/>
<springBootApplication id="guide-spring-boot"
location="guide-spring-boot-0.1.0.jar"
name="guide-spring-boot" />

<!-- end::springBootApplication[] -->

</server>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
<springBootApplication id="guide-spring-boot"
location="guide-spring-boot-0.2.0.jar"
name="guide-spring-boot" />
</server>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
buildscript {
ext {
springBootVersion = '3.1.3'
}
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "io.openliberty.tools:liberty-gradle-plugin:$lgpVersion"
}
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'liberty'

group = 'liberty.gradle'
version = '1.0-SNAPSHOT'
sourceCompatibility = 17

repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
testImplementation('org.springframework.boot:spring-boot-starter-test')
libertyRuntime group: 'io.openliberty', name: 'openliberty-runtime', version: '23.0.0.10'
}

liberty {
server {
serverXmlFile = file("src/main/liberty/alternateConfig/server_springboot.xml")
}
}

0 comments on commit 8ec4372

Please sign in to comment.