Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Spring Boot Gradle plugin using plugins DSL #909

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ abstract class AbstractLibertyTask extends DefaultTask {
if (project.plugins.hasPlugin("org.springframework.boot")) {
try {
for (Dependency dep : project.buildscript.configurations.classpath.getAllDependencies().toArray()) {
if ("org.springframework.boot".equals(dep.getGroup()) && "spring-boot-gradle-plugin".equals(dep.getName())) {
if ("org.springframework.boot".equals(dep.getGroup()) &&
("spring-boot-gradle-plugin".equals(dep.getName()) ||
"org.springframework.boot.gradle.plugin".equals(dep.getName()))) {
version = dep.getVersion()
break
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,20 @@ public class TestSpringBootApplication30 extends AbstractIntegrationTest{
throw new AssertionError ("Fail on task deploy.", e)
}
}

@Test
public void test_spring_boot_plugins_dsl_apps_30() {
try {
runTasks(buildDir, 'deploy', 'libertyStart')

String webPage = new URL("http://localhost:9080").getText()
Assert.assertEquals("Did not get expected http response.","Hello!", webPage)
Assert.assertTrue('defaultServer/dropins has app deployed',
new File(buildDir, 'build/wlp/usr/servers/defaultServer/dropins').list().size() == 0)
Assert.assertTrue('no app in apps folder',
new File(buildDir, "build/wlp/usr/servers/defaultServer/apps/thin-${testName.getMethodName()}-1.0-SNAPSHOT.jar").exists() )
} catch (Exception e) {
throw new AssertionError ("Fail on task deploy.", e)
}
}
}
10 changes: 9 additions & 1 deletion src/test/resources/sample.springboot3/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
//Empty
pluginManagement {
repositories {
mavenCentral()
mavenLocal()
maven {
url = uri(file("$rootDir/../../plugin-test-repository/"))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.3'
id 'io.spring.dependency-management' version '1.1.6'
id 'io.openliberty.tools.gradle.Liberty' version "$lgpVersion"
}

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

repositories {
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
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/config/server30.xml")
}
}
Loading