Drop custom software component in favor of just publishing an artifact

Previously, Spring Boot's Gradle plugin provided custom software
components (bootJava and bootWeb) for publishing the artifacts created
by the standard bootJar and bootWar tasks respectively. Providing a
custom software component requires the usage of some of Gradle's
internal APIs and this has now proven to be more trouble than it is
worth.

This commit removes the custom software component and documents how
to publish the artifact created by a BootJar or BootWar task directly
instead.

Closes gh-9153
This commit is contained in:
Andy Wilkinson
2017-05-31 14:14:55 +01:00
parent 725a42a67e
commit 4a605f6270
14 changed files with 14 additions and 184 deletions

View File

@@ -66,19 +66,6 @@ public class JavaPluginActionIntegrationTests {
.getOutput()).contains("bootRun exists = true");
}
@Test
public void noBootJavaSoftwareComponentWithoutJavaPluginApplied() {
assertThat(this.gradleBuild.build("componentExists", "-PcomponentName=bootJava")
.getOutput()).contains("bootJava exists = false");
}
@Test
public void applyingJavaPluginCreatesBootJavaSoftwareComponent() {
assertThat(this.gradleBuild
.build("componentExists", "-PcomponentName=bootJava", "-PapplyJavaPlugin")
.getOutput()).contains("bootJava exists = true");
}
@Test
public void javaCompileTasksUseUtf8Encoding() {
assertThat(this.gradleBuild.build("javaCompileEncoding", "-PapplyJavaPlugin")

View File

@@ -53,19 +53,6 @@ public class WarPluginActionIntegrationTests {
.getOutput()).contains("bootWar exists = true");
}
@Test
public void noBootWebSoftwareComponentWithoutJavaPluginApplied() {
assertThat(this.gradleBuild.build("componentExists", "-PcomponentName=bootWeb")
.getOutput()).contains("bootWeb exists = false");
}
@Test
public void applyingJavaPluginCreatesBootWebSoftwareComponent() {
assertThat(this.gradleBuild
.build("componentExists", "-PcomponentName=bootWeb", "-PapplyWarPlugin")
.getOutput()).contains("bootWeb exists = true");
}
@Test
public void assembleRunsBootWarAndWarIsSkipped() {
BuildResult result = this.gradleBuild.build("assemble");

View File

@@ -16,12 +16,6 @@ task('taskExists') {
}
}
task('componentExists') {
doFirst {
println "$componentName exists = ${components.findByName(componentName) != null}"
}
}
task('javaCompileEncoding') {
doFirst {
tasks.withType(JavaCompile) {

View File

@@ -15,9 +15,3 @@ task('taskExists') {
println "$taskName exists = ${tasks.findByName(taskName) != null}"
}
}
task('componentExists') {
doFirst {
println "$componentName exists = ${components.findByName(componentName) != null}"
}
}

View File

@@ -22,8 +22,8 @@ publishing {
}
}
publications {
mavenBootJava(MavenPublication) {
from components.bootJava
bootJava(MavenPublication) {
artifact bootJar
}
}
}

View File

@@ -22,8 +22,8 @@ publishing {
}
}
publications {
mavenBootWeb(MavenPublication) {
from components.bootWeb
bootWeb(MavenPublication) {
artifact bootWar
}
}
}