From d43b1ae3a5144517e3afb5a49311f2cd1c492b7f Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 3 Apr 2017 15:41:48 +0100 Subject: [PATCH] Polish the Gradle plugin's javadoc --- .../boot/gradle/dsl/SpringBootExtension.java | 1 + .../plugin/PluginApplicationAction.java | 6 ++++ .../boot/gradle/plugin/SpringBootPlugin.java | 10 ++++++ .../UnresolvedDependenciesAnalyzer.java | 2 +- .../gradle/tasks/bundling/BootArchive.java | 1 + .../boot/gradle/tasks/bundling/BootJar.java | 4 +++ .../boot/gradle/tasks/bundling/BootWar.java | 15 ++++++-- .../bundling/LaunchScriptConfiguration.java | 35 +++++++++++++++++++ .../gradle/tasks/bundling/ZipCompression.java | 1 + .../boot/gradle/tasks/run/BootRun.java | 1 + 10 files changed, 73 insertions(+), 3 deletions(-) diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl/SpringBootExtension.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl/SpringBootExtension.java index 468dd12303..04896a6385 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl/SpringBootExtension.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl/SpringBootExtension.java @@ -33,6 +33,7 @@ import org.springframework.boot.gradle.tasks.buildinfo.BuildInfoProperties; * Entry point to Spring Boot's Gradle DSL. * * @author Andy Wilkinson + * @since 2.0.0 */ public class SpringBootExtension { diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/PluginApplicationAction.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/PluginApplicationAction.java index 5cfb9dec7f..a02de18610 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/PluginApplicationAction.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/PluginApplicationAction.java @@ -28,6 +28,12 @@ import org.gradle.api.Project; */ interface PluginApplicationAction extends Action { + /** + * The class of the {@code Plugin} that, when applied, will trigger the execution of + * this action. + * + * @return the plugin class + */ Class> getPluginClass(); } diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java index ba5ed87807..8d6bf837f2 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java @@ -39,26 +39,36 @@ public class SpringBootPlugin implements Plugin { /** * The name of the {@link Configuration} that contains Spring Boot archives. + * + * @since 2.0.0 */ public static final String BOOT_ARCHIVES_CONFIURATION_NAME = "bootArchives"; /** * The name of the {@link SoftwareComponent} for a Spring Boot Java application. + * + * @since 2.0.0 */ public static final String BOOT_JAVA_SOFTWARE_COMPONENT_NAME = "bootJava"; /** * The name of the {@link SoftwareComponent} for a Spring Boot Web application. + * + * @since 2.0.0 */ public static final String BOOT_WEB_SOFTWARE_COMPONENT_NAME = "bootWeb"; /** * The name of the default {@link BootJar} task. + * + * @since 2.0.0 */ public static final String BOOT_JAR_TASK_NAME = "bootJar"; /** * The name of the default {@link BootWar} task. + * + * @since 2.0.0 */ public static final String BOOT_WAR_TASK_NAME = "bootWar"; diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/UnresolvedDependenciesAnalyzer.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/UnresolvedDependenciesAnalyzer.java index 621d01d45b..b56ab5cea0 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/UnresolvedDependenciesAnalyzer.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/UnresolvedDependenciesAnalyzer.java @@ -40,7 +40,7 @@ class UnresolvedDependenciesAnalyzer { private Set dependenciesWithNoVersion = new HashSet<>(); - public void analyze(Set unresolvedDependencies) { + void analyze(Set unresolvedDependencies) { this.dependenciesWithNoVersion = unresolvedDependencies.stream() .map(unresolvedDependency -> unresolvedDependency.getSelector()) .filter(this::hasNoVersion).collect(Collectors.toSet()); diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchive.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchive.java index 2305491ac0..88996acd78 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchive.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootArchive.java @@ -30,6 +30,7 @@ import org.gradle.api.tasks.Optional; * A Spring Boot "fat" archive task. * * @author Andy Wilkinson + * @since 2.0.0 */ public interface BootArchive extends Task { diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java index 15682398f7..74befe9eb6 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java @@ -33,6 +33,7 @@ import org.gradle.api.tasks.bundling.Jar; * A custom {@link Jar} task that produces a Spring Boot executable jar. * * @author Andy Wilkinson + * @since 2.0.0 */ public class BootJar extends Jar implements BootArchive { @@ -43,6 +44,9 @@ public class BootJar extends Jar implements BootArchive { private String mainClass; + /** + * Creates a new {@code BootJar} task. + */ public BootJar() { CopySpec bootInf = getRootSpec().addChildBeforeSpec(getMainSpec()) .into("BOOT-INF"); diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java index 8bf8ff15ba..3b704135db 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java @@ -34,6 +34,7 @@ import org.gradle.api.tasks.bundling.War; * A custom {@link War} task that produces a Spring Boot executable war. * * @author Andy Wilkinson + * @since 2.0.0 */ public class BootWar extends War implements BootArchive { @@ -44,6 +45,9 @@ public class BootWar extends War implements BootArchive { private FileCollection providedClasspath; + /** + * Creates a new {@code BootWar} task. + */ public BootWar() { getWebInf().into("lib-provided", copySpec -> copySpec @@ -92,14 +96,21 @@ public class BootWar extends War implements BootArchive { action.execute(getLaunchScript()); } + /** + * Returns the provided classpath, the contents of which will be included in the + * {@code WEB-INF/lib-provided} directory of the war. + * + * @return the provided classpath + */ @Optional public FileCollection getProvidedClasspath() { return this.providedClasspath; } /** - * Adds files to the provided classpath to include in the war. The given - * {@code classpath} are evaluated as per {@link Project#files(Object...)}. + * Adds files to the provided classpath to include in the {@code WEB-INF/lib-provided} + * directory of the war. The given {@code classpath} are evaluated as per + * {@link Project#files(Object...)}. * * @param classpath the additions to the classpath */ diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java index 3e31f76842..40ee454fb5 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LaunchScriptConfiguration.java @@ -28,6 +28,7 @@ import org.springframework.boot.loader.tools.FileUtils; * Encapsulates the configuration of the launch script for an executable jar or war. * * @author Andy Wilkinson + * @since 2.0.0 */ public class LaunchScriptConfiguration implements Serializable { @@ -37,26 +38,60 @@ public class LaunchScriptConfiguration implements Serializable { private File script; + /** + * Returns whether the launch script is included. Defaults to {@code false}. + * + * @return {@code true} is the script is included, otherwise {@code false}. + */ public boolean isIncluded() { return this.included; } + /** + * Sets whether the launch script is included. Defaults to {@code false}. + * + * @param included {@code true} is the script is included, otherwise {@code false}. + */ public void setIncluded(boolean included) { this.included = included; } + /** + * Returns the properties that are applied to the launch script when it's being + * including in the executable archive. + * + * @return the properties + */ public Map getProperties() { return this.properties; } + /** + * Sets the properties that are applied to the launch script when it's being including + * in the executable archive. + * + * @param properties the properties + */ public void properties(Map properties) { this.properties.putAll(properties); } + /** + * Returns the script {@link File} that will be included in the executable archive. + * When {@code null}, the default launch script will be used. + * + * @return the script file + */ public File getScript() { return this.script; } + /** + * Sets the script {@link File} that will be included in the executable archive. When + * {@code null}, the default launch script will be used. + * + * @param script the script file + */ public void setScript(File script) { this.script = script; } diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/ZipCompression.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/ZipCompression.java index 9aa624732b..782cddedd4 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/ZipCompression.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/ZipCompression.java @@ -22,6 +22,7 @@ import java.util.zip.ZipEntry; * An enumeration of supported compression options for an entry in a ZIP archive. * * @author Andy Wilkinson + * @since 2.0.0 */ public enum ZipCompression { diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/run/BootRun.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/run/BootRun.java index 2a0b41cc0e..07a463ae7f 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/run/BootRun.java +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/run/BootRun.java @@ -25,6 +25,7 @@ import org.gradle.api.tasks.SourceSetOutput; * Custom {@link JavaExec} task for running a Spring Boot application. * * @author Andy Wilkinson + * @since 2.0.0 */ public class BootRun extends JavaExec {