- *
- * @author Phillip Webb
- * @author Dave Syer
- */
-public class SpringBootPluginExtension {
-
- enum LayoutType {
-
- JAR(new Layouts.Jar()),
-
- WAR(new Layouts.War()),
-
- ZIP(new Layouts.Expanded()),
-
- DIR(new Layouts.Expanded()),
-
- MODULE(new Layouts.Module()),
-
- NONE(new Layouts.None());
-
- Layout layout;
-
- private LayoutType(Layout layout) {
- this.layout = layout;
- }
- }
-
- /**
- * The main class that should be run. Instead of setting this explicitly you can use the
- * 'mainClassName' of the project or the 'main' of the 'run' task. If not specified the
- * value from the MANIFEST will be used, or if no manifest entry is the archive will be
- * searched for a suitable class.
- */
- String mainClass
-
- /**
- * The classifier (file name part before the extension). Instead of setting this explicitly
- * you can use the 'classifier' property of the 'bootRepackage' task. If not specified the archive
- * will be replaced instead of renamed.
- */
- String classifier
-
- /**
- * The name of the ivy configuration name to treat as 'provided' (when packaging
- * those dependencies in a separate path). If not specified 'providedRuntime' will
- * be used.
- */
- String providedConfiguration
-
- /**
- * The name of the custom configuration to use.
- */
- String customConfiguration
-
- /**
- * If the original source archive should be backed-up before being repackaged.
- */
- boolean backupSource = true;
-
- /**
- * The layout of the archive if it can't be derived from the file extension.
- * Valid values are JAR, WAR, ZIP, DIR (for exploded zip file). ZIP and DIR
- * are actually synonymous, and should be used if there is no MANIFEST.MF
- * available, or if you want the MANIFEST.MF 'Main-Class' to be
- * PropertiesLauncher. Gradle will coerce literal String values to the
- * correct type.
- */
- LayoutType layout;
-
- /**
- * Convenience method for use in a custom task.
- * @return the Layout to use or null if not explicitly set
- */
- Layout convertLayout() {
- (layout == null ? null : layout.layout)
- }
-
- /**
- * Libraries that must be unpacked from fat jars in order to run. Use Strings in the
- * form {@literal groupId:artifactId}.
- */
- Set requiresUnpack;
-
- /**
- * Location of an agent jar to attach to the VM when running the application with runJar task.
- */
- File agent;
-
- /**
- * Flag to indicate that the agent requires -noverify (and the plugin will refuse to start if it is not set)
- */
- Boolean noverify;
-
- /**
- * If exclude rules should be applied to dependencies based on the spring-dependencies-bom
- */
- boolean applyExcludeRules = true;
-
- /**
- * If a fully executable jar (for *nix machines) should be generated by prepending a
- * launch script to the jar.
- */
- boolean executable = false;
-
- /**
- * The embedded launch script to prepend to the front of the jar if it is fully
- * executable. If not specified the 'Spring Boot' default script will be used.
- */
- File embeddedLaunchScript;
-
- /**
- * Properties that should be expanded in the embedded launch script.
- */
- Map embeddedLaunchScriptProperties;
-
-}
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/dependencymanagement/DependencyManagementPluginFeatures.groovy b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/dependencymanagement/DependencyManagementPluginFeatures.groovy
deleted file mode 100644
index 11105c7a0a9..00000000000
--- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/dependencymanagement/DependencyManagementPluginFeatures.groovy
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2012-2015 the original author or authors.
- *
- * 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 org.springframework.boot.gradle.dependencymanagement;
-
-import org.gradle.api.Project;
-import org.springframework.boot.gradle.PluginFeatures;
-
-import io.spring.gradle.dependencymanagement.DependencyManagementExtension
-import io.spring.gradle.dependencymanagement.DependencyManagementPlugin
-
-/**
- * {@link PluginFeatures} to configure dependency management
- *
- * @author Andy Wilkinson
- */
-class DependencyManagementPluginFeatures implements PluginFeatures {
-
- @Override
- void apply(Project project) {
- project.plugins.apply(DependencyManagementPlugin)
- DependencyManagementExtension dependencyManagement = project.extensions
- .findByType(DependencyManagementExtension)
- dependencyManagement.imports {
- def version = DependencyManagementPluginFeatures.class.getPackage().implementationVersion
- mavenBom "org.springframework.boot:spring-boot-starter-parent:$version"
- }
- }
-}
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/PluginFeatures.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/PluginFeatures.java
similarity index 100%
rename from spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/PluginFeatures.java
rename to spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/PluginFeatures.java
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/SpringBootPlugin.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/SpringBootPlugin.java
new file mode 100644
index 00000000000..c507e9977ff
--- /dev/null
+++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/SpringBootPlugin.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2012-2015 the original author or authors.
+ *
+ * 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 org.springframework.boot.gradle;
+
+import org.gradle.api.Action;
+import org.gradle.api.Plugin;
+import org.gradle.api.Project;
+import org.gradle.api.Task;
+import org.gradle.api.plugins.JavaPlugin;
+import org.gradle.api.tasks.compile.JavaCompile;
+import org.springframework.boot.gradle.agent.AgentPluginFeatures;
+import org.springframework.boot.gradle.dependencymanagement.DependencyManagementPluginFeatures;
+import org.springframework.boot.gradle.repackage.RepackagePluginFeatures;
+import org.springframework.boot.gradle.run.RunPluginFeatures;
+
+/**
+ * Gradle 'Spring Boot' {@link Plugin}.
+ *
+ * @author Phillip Webb
+ * @author Dave Syer
+ * @author Andy Wilkinson
+ */
+class SpringBootPlugin implements Plugin {
+
+ @Override
+ public void apply(Project project) {
+ project.getExtensions().create("springBoot", SpringBootPluginExtension.class);
+ project.getPlugins().apply(JavaPlugin.class);
+ new AgentPluginFeatures().apply(project);
+ new RepackagePluginFeatures().apply(project);
+ new RunPluginFeatures().apply(project);
+ new DependencyManagementPluginFeatures().apply(project);
+ project.getTasks().withType(JavaCompile.class).all(new SetUtf8EncodingAction());
+ }
+
+ private static class SetUtf8EncodingAction implements Action {
+
+ @Override
+ public void execute(final JavaCompile compile) {
+ compile.doFirst(new Action() {
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public void execute(Task t) {
+ if (compile.getOptions().getEncoding() == null) {
+ compile.getOptions().setEncoding("UTF-8");
+ }
+ }
+
+ });
+ }
+
+ }
+
+}
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/SpringBootPluginExtension.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/SpringBootPluginExtension.java
new file mode 100644
index 00000000000..af6b1015fe7
--- /dev/null
+++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/SpringBootPluginExtension.java
@@ -0,0 +1,263 @@
+/*
+ * Copyright 2012-2015 the original author or authors.
+ *
+ * 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 org.springframework.boot.gradle;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Set;
+
+import org.springframework.boot.loader.tools.Layout;
+import org.springframework.boot.loader.tools.Layouts;
+
+/**
+ * Gradle DSL Extension for 'Spring Boot'. Most of the time Spring Boot can guess the
+ * settings in this extension, but occasionally you might need to explicitly set one or
+ * two of them. E.g.
+ *
+ *
+ *
+ * @author Phillip Webb
+ * @author Dave Syer
+ */
+public class SpringBootPluginExtension {
+
+ /**
+ * The main class that should be run. Instead of setting this explicitly you can use
+ * the 'mainClassName' of the project or the 'main' of the 'run' task. If not
+ * specified the value from the MANIFEST will be used, or if no manifest entry is the
+ * archive will be searched for a suitable class.
+ */
+ String mainClass;
+
+ /**
+ * The classifier (file name part before the extension). Instead of setting this
+ * explicitly you can use the 'classifier' property of the 'bootRepackage' task. If
+ * not specified the archive will be replaced instead of renamed.
+ */
+ String classifier;
+
+ /**
+ * The name of the ivy configuration name to treat as 'provided' (when packaging those
+ * dependencies in a separate path). If not specified 'providedRuntime' will be used.
+ */
+ String providedConfiguration;
+
+ /**
+ * The name of the custom configuration to use.
+ */
+ String customConfiguration;
+
+ /**
+ * If the original source archive should be backed-up before being repackaged.
+ */
+ boolean backupSource = true;
+
+ /**
+ * The layout of the archive if it can't be derived from the file extension. Valid
+ * values are JAR, WAR, ZIP, DIR (for exploded zip file). ZIP and DIR are actually
+ * synonymous, and should be used if there is no MANIFEST.MF available, or if you want
+ * the MANIFEST.MF 'Main-Class' to be PropertiesLauncher. Gradle will coerce literal
+ * String values to the correct type.
+ */
+ LayoutType layout;
+
+ /**
+ * Libraries that must be unpacked from fat jars in order to run. Use Strings in the
+ * form {@literal groupId:artifactId}.
+ */
+ Set requiresUnpack;
+
+ /**
+ * Location of an agent jar to attach to the VM when running the application with
+ * runJar task.
+ */
+ File agent;
+
+ /**
+ * Flag to indicate that the agent requires -noverify (and the plugin will refuse to
+ * start if it is not set).
+ */
+ Boolean noverify;
+
+ /**
+ * If exclude rules should be applied to dependencies based on the
+ * spring-dependencies-bom.
+ */
+ boolean applyExcludeRules = true;
+
+ /**
+ * If a fully executable jar (for *nix machines) should be generated by prepending a
+ * launch script to the jar.
+ */
+ boolean executable = false;
+
+ /**
+ * The embedded launch script to prepend to the front of the jar if it is fully
+ * executable. If not specified the 'Spring Boot' default script will be used.
+ */
+ File embeddedLaunchScript;
+
+ /**
+ * Properties that should be expanded in the embedded launch script.
+ */
+ Map embeddedLaunchScriptProperties;
+
+ /**
+ * Convenience method for use in a custom task.
+ * @return the Layout to use or null if not explicitly set
+ */
+ public Layout convertLayout() {
+ return (this.layout == null ? null : this.layout.layout);
+ }
+
+ public String getMainClass() {
+ return this.mainClass;
+ }
+
+ public void setMainClass(String mainClass) {
+ this.mainClass = mainClass;
+ }
+
+ public String getClassifier() {
+ return this.classifier;
+ }
+
+ public void setClassifier(String classifier) {
+ this.classifier = classifier;
+ }
+
+ public String getProvidedConfiguration() {
+ return this.providedConfiguration;
+ }
+
+ public void setProvidedConfiguration(String providedConfiguration) {
+ this.providedConfiguration = providedConfiguration;
+ }
+
+ public String getCustomConfiguration() {
+ return this.customConfiguration;
+ }
+
+ public void setCustomConfiguration(String customConfiguration) {
+ this.customConfiguration = customConfiguration;
+ }
+
+ public boolean isBackupSource() {
+ return this.backupSource;
+ }
+
+ public void setBackupSource(boolean backupSource) {
+ this.backupSource = backupSource;
+ }
+
+ public LayoutType getLayout() {
+ return this.layout;
+ }
+
+ public void setLayout(LayoutType layout) {
+ this.layout = layout;
+ }
+
+ public Set getRequiresUnpack() {
+ return this.requiresUnpack;
+ }
+
+ public void setRequiresUnpack(Set requiresUnpack) {
+ this.requiresUnpack = requiresUnpack;
+ }
+
+ public File getAgent() {
+ return this.agent;
+ }
+
+ public void setAgent(File agent) {
+ this.agent = agent;
+ }
+
+ public Boolean getNoverify() {
+ return this.noverify;
+ }
+
+ public void setNoverify(Boolean noverify) {
+ this.noverify = noverify;
+ }
+
+ public boolean isApplyExcludeRules() {
+ return this.applyExcludeRules;
+ }
+
+ public void setApplyExcludeRules(boolean applyExcludeRules) {
+ this.applyExcludeRules = applyExcludeRules;
+ }
+
+ public boolean isExecutable() {
+ return this.executable;
+ }
+
+ public void setExecutable(boolean executable) {
+ this.executable = executable;
+ }
+
+ public File getEmbeddedLaunchScript() {
+ return this.embeddedLaunchScript;
+ }
+
+ public void setEmbeddedLaunchScript(File embeddedLaunchScript) {
+ this.embeddedLaunchScript = embeddedLaunchScript;
+ }
+
+ public Map getEmbeddedLaunchScriptProperties() {
+ return this.embeddedLaunchScriptProperties;
+ }
+
+ public void setEmbeddedLaunchScriptProperties(
+ Map embeddedLaunchScriptProperties) {
+ this.embeddedLaunchScriptProperties = embeddedLaunchScriptProperties;
+ }
+
+ /**
+ * Layout Types.
+ */
+ enum LayoutType {
+
+ JAR(new Layouts.Jar()),
+
+ WAR(new Layouts.War()),
+
+ ZIP(new Layouts.Expanded()),
+
+ DIR(new Layouts.Expanded()),
+
+ MODULE(new Layouts.Module()),
+
+ NONE(new Layouts.None());
+
+ Layout layout;
+
+ LayoutType(Layout layout) {
+ this.layout = layout;
+ }
+
+ }
+
+}
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/agent/AgentPluginFeatures.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/agent/AgentPluginFeatures.java
similarity index 94%
rename from spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/agent/AgentPluginFeatures.java
rename to spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/agent/AgentPluginFeatures.java
index efca5a3ee66..496249c1ddc 100644
--- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/agent/AgentPluginFeatures.java
+++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/agent/AgentPluginFeatures.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/agent/AgentTasksEnhancer.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/agent/AgentTasksEnhancer.java
similarity index 91%
rename from spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/agent/AgentTasksEnhancer.java
rename to spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/agent/AgentTasksEnhancer.java
index 0ffdca2cf1d..68706779d3e 100644
--- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/agent/AgentTasksEnhancer.java
+++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/agent/AgentTasksEnhancer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,8 @@ import org.springframework.boot.gradle.SpringBootPluginExtension;
*
*
*
Use "-Prun.agent=[path-to-jar]" on the gradle command line
- *
Add an "agent" property (jar file) to the "springBoot" extension in build.gradle
+ *
Add an "agent" property (jar file) to the "springBoot" extension in build.gradle
+ *
*
As a special case springloaded is detected as a build script dependency
*
*
@@ -59,8 +60,8 @@ public class AgentTasksEnhancer implements Action {
private void setup(Project project) {
project.getLogger().info("Configuring agent");
- SpringBootPluginExtension extension = project.getExtensions().getByType(
- SpringBootPluginExtension.class);
+ SpringBootPluginExtension extension = project.getExtensions()
+ .getByType(SpringBootPluginExtension.class);
this.noverify = extension.getNoverify();
this.agent = getAgent(project, extension);
if (this.agent == null) {
@@ -114,8 +115,8 @@ public class AgentTasksEnhancer implements Action {
if (this.noverify != null && this.noverify) {
exec.jvmArgs("-noverify");
}
- Iterable> defaultJvmArgs = exec.getConventionMapping().getConventionValue(
- null, "jvmArgs", false);
+ Iterable> defaultJvmArgs = exec.getConventionMapping()
+ .getConventionValue(null, "jvmArgs", false);
if (defaultJvmArgs != null) {
exec.jvmArgs(defaultJvmArgs);
}
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dependencymanagement/DependencyManagementPluginFeatures.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dependencymanagement/DependencyManagementPluginFeatures.java
new file mode 100644
index 00000000000..4850362c0ba
--- /dev/null
+++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dependencymanagement/DependencyManagementPluginFeatures.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2012-2015 the original author or authors.
+ *
+ * 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 org.springframework.boot.gradle.dependencymanagement;
+
+import org.gradle.api.Project;
+import org.springframework.boot.gradle.PluginFeatures;
+import org.springframework.util.ReflectionUtils;
+
+import groovy.lang.Closure;
+import io.spring.gradle.dependencymanagement.DependencyManagementExtension;
+import io.spring.gradle.dependencymanagement.DependencyManagementPlugin;
+
+/**
+ * {@link PluginFeatures} to configure dependency management.
+ *
+ * @author Andy Wilkinson
+ * @author Phillip Webb
+ * @since 1.3.0
+ */
+public class DependencyManagementPluginFeatures implements PluginFeatures {
+
+ private static final String SPRING_BOOT_VERSION = DependencyManagementPluginFeatures.class
+ .getPackage().getImplementationVersion();
+
+ private static final String SPRING_BOOT_BOM = "org.springframework.boot:spring-boot-starter-parent:"
+ + SPRING_BOOT_VERSION;
+
+ @Override
+ public void apply(Project project) {
+ project.getPlugins().apply(DependencyManagementPlugin.class);
+ DependencyManagementExtension dependencyManagement = project.getExtensions()
+ .findByType(DependencyManagementExtension.class);
+ dependencyManagement.imports(new Closure(this) {
+
+ @Override
+ public Void call(Object... args) {
+ try {
+ ReflectionUtils.findMethod(getDelegate().getClass(), "mavenBom",
+ String.class).invoke(getDelegate(), SPRING_BOOT_BOM);
+ return null;
+ }
+ catch (Exception ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ });
+ }
+
+}
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/repackage/ProjectLibraries.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/ProjectLibraries.java
similarity index 95%
rename from spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/repackage/ProjectLibraries.java
rename to spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/ProjectLibraries.java
index fb9d89f88aa..bd5d39b7272 100644
--- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/repackage/ProjectLibraries.java
+++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/ProjectLibraries.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -96,9 +96,10 @@ class ProjectLibraries implements Libraries {
}
}
- private Set getLibraries(String configurationName, LibraryScope scope) {
- Configuration configuration = (configurationName == null ? null : this.project
- .getConfigurations().findByName(configurationName));
+ private Set getLibraries(String configurationName,
+ LibraryScope scope) {
+ Configuration configuration = (configurationName == null ? null
+ : this.project.getConfigurations().findByName(configurationName));
if (configuration == null) {
return null;
}
@@ -118,8 +119,8 @@ class ProjectLibraries implements Libraries {
if (dependency instanceof FileCollectionDependency) {
FileCollectionDependency fileDependency = (FileCollectionDependency) dependency;
for (File file : fileDependency.resolve()) {
- libraries.add(new GradleLibrary(fileDependency.getGroup(), file,
- scope));
+ libraries.add(
+ new GradleLibrary(fileDependency.getGroup(), file, scope));
}
}
else if (dependency instanceof ProjectDependency) {
@@ -231,8 +232,8 @@ class ProjectLibraries implements Libraries {
public boolean isUnpackRequired() {
if (ProjectLibraries.this.extension.getRequiresUnpack() != null) {
ModuleVersionIdentifier id = this.artifact.getModuleVersion().getId();
- return ProjectLibraries.this.extension.getRequiresUnpack().contains(
- id.getGroup() + ":" + id.getName());
+ return ProjectLibraries.this.extension.getRequiresUnpack()
+ .contains(id.getGroup() + ":" + id.getName());
}
return false;
}
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/repackage/RepackagePluginFeatures.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/RepackagePluginFeatures.java
similarity index 95%
rename from spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/repackage/RepackagePluginFeatures.java
rename to spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/RepackagePluginFeatures.java
index fd0c45188f4..642bccc89d6 100644
--- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/repackage/RepackagePluginFeatures.java
+++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/RepackagePluginFeatures.java
@@ -63,8 +63,8 @@ public class RepackagePluginFeatures implements PluginFeatures {
+ "archives so that they can be executed from the command "
+ "line using 'java -jar'");
task.setGroup(BasePlugin.BUILD_GROUP);
- Configuration runtimeConfiguration = project.getConfigurations().getByName(
- JavaPlugin.RUNTIME_CONFIGURATION_NAME);
+ Configuration runtimeConfiguration = project.getConfigurations()
+ .getByName(JavaPlugin.RUNTIME_CONFIGURATION_NAME);
TaskDependency runtimeProjectDependencyJarTasks = runtimeConfiguration
.getTaskDependencyFromProjectDependency(true, JavaPlugin.JAR_TASK_NAME);
task.dependsOn(
@@ -103,8 +103,8 @@ public class RepackagePluginFeatures implements PluginFeatures {
* @param project the source project
*/
private void registerRepackageTaskProperty(Project project) {
- project.getExtensions().getExtraProperties()
- .set("BootRepackage", RepackageTask.class);
+ project.getExtensions().getExtraProperties().set("BootRepackage",
+ RepackageTask.class);
}
/**
@@ -143,8 +143,8 @@ public class RepackagePluginFeatures implements PluginFeatures {
+ this.task.getName());
File inputFile = jarTask.getArchivePath();
String outputName = inputFile.getName();
- outputName = StringUtils.stripFilenameExtension(outputName) + "-"
- + classifier + "." + StringUtils.getFilenameExtension(outputName);
+ outputName = StringUtils.stripFilenameExtension(outputName) + "-" + classifier
+ + "." + StringUtils.getFilenameExtension(outputName);
File outputFile = new File(inputFile.getParentFile(), outputName);
this.task.getInputs().file(jarTask);
addLibraryDependencies(this.task);
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/repackage/RepackageTask.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/RepackageTask.java
similarity index 93%
rename from spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/repackage/RepackageTask.java
rename to spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/RepackageTask.java
index ee041e3d240..5db3af4c34c 100644
--- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/repackage/RepackageTask.java
+++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/repackage/RepackageTask.java
@@ -91,16 +91,16 @@ public class RepackageTask extends DefaultTask {
@TaskAction
public void repackage() {
Project project = getProject();
- SpringBootPluginExtension extension = project.getExtensions().getByType(
- SpringBootPluginExtension.class);
+ SpringBootPluginExtension extension = project.getExtensions()
+ .getByType(SpringBootPluginExtension.class);
ProjectLibraries libraries = getLibraries();
project.getTasks().withType(Jar.class, new RepackageAction(extension, libraries));
}
public ProjectLibraries getLibraries() {
Project project = getProject();
- SpringBootPluginExtension extension = project.getExtensions().getByType(
- SpringBootPluginExtension.class);
+ SpringBootPluginExtension extension = project.getExtensions()
+ .getByType(SpringBootPluginExtension.class);
ProjectLibraries libraries = new ProjectLibraries(project, extension);
if (extension.getProvidedConfiguration() != null) {
libraries.setProvidedConfigurationName(extension.getProvidedConfiguration());
@@ -123,8 +123,7 @@ public class RepackageTask extends DefaultTask {
private final ProjectLibraries libraries;
- RepackageAction(SpringBootPluginExtension extension,
- ProjectLibraries libraries) {
+ RepackageAction(SpringBootPluginExtension extension, ProjectLibraries libraries) {
this.extension = extension;
this.libraries = libraries;
}
@@ -251,10 +250,9 @@ public class RepackageTask extends DefaultTask {
finally {
long duration = System.currentTimeMillis() - startTime;
if (duration > FIND_WARNING_TIMEOUT) {
- getLogger().warn(
- "Searching for the main-class is taking "
- + "some time, consider using setting "
- + "'springBoot.mainClass'");
+ getLogger().warn("Searching for the main-class is taking "
+ + "some time, consider using setting "
+ + "'springBoot.mainClass'");
}
}
}
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/BootRunTask.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/run/BootRunTask.java
similarity index 96%
rename from spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/BootRunTask.java
rename to spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/run/BootRunTask.java
index 6557e51db81..d816ad7e9f5 100644
--- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/BootRunTask.java
+++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/run/BootRunTask.java
@@ -65,8 +65,8 @@ public class BootRunTask extends JavaExec {
private void addResourcesIfNecessary() {
if (this.addResources) {
SourceSet mainSourceSet = SourceSets.findMainSourceSet(getProject());
- final File outputDir = (mainSourceSet == null ? null : mainSourceSet
- .getOutput().getResourcesDir());
+ final File outputDir = (mainSourceSet == null ? null
+ : mainSourceSet.getOutput().getResourcesDir());
final Set resources = new LinkedHashSet();
if (mainSourceSet != null) {
resources.addAll(mainSourceSet.getResources().getSrcDirs());
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/FindMainClassTask.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/run/FindMainClassTask.java
similarity index 91%
rename from spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/FindMainClassTask.java
rename to spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/run/FindMainClassTask.java
index 6593963aed5..45b7cbf6d60 100644
--- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/FindMainClassTask.java
+++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/run/FindMainClassTask.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,8 +70,8 @@ public class FindMainClassTask extends DefaultTask {
String mainClass = null;
// Try the SpringBoot extension setting
- SpringBootPluginExtension bootExtension = project.getExtensions().getByType(
- SpringBootPluginExtension.class);
+ SpringBootPluginExtension bootExtension = project.getExtensions()
+ .getByType(SpringBootPluginExtension.class);
if (bootExtension.getMainClass() != null) {
mainClass = bootExtension.getMainClass();
}
@@ -99,13 +99,11 @@ public class FindMainClassTask extends DefaultTask {
if (mainClass == null) {
// Search
if (this.mainClassSourceSetOutput != null) {
- project.getLogger().debug(
- "Looking for main in: "
- + this.mainClassSourceSetOutput.getClassesDir());
+ project.getLogger().debug("Looking for main in: "
+ + this.mainClassSourceSetOutput.getClassesDir());
try {
- mainClass = MainClassFinder
- .findSingleMainClass(this.mainClassSourceSetOutput
- .getClassesDir());
+ mainClass = MainClassFinder.findSingleMainClass(
+ this.mainClassSourceSetOutput.getClassesDir());
project.getLogger().info("Computed main class: " + mainClass);
}
catch (IOException ex) {
diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/RunPluginFeatures.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/run/RunPluginFeatures.java
similarity index 90%
rename from spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/RunPluginFeatures.java
rename to spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/run/RunPluginFeatures.java
index 8e6754e6b60..cda09fc0466 100644
--- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/run/RunPluginFeatures.java
+++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/run/RunPluginFeatures.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2014 the original author or authors.
+ * Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,8 +47,8 @@ public class RunPluginFeatures implements PluginFeatures {
}
private void mainClassNameFinder(Project project) {
- FindMainClassTask findMainClassTask = project.getTasks().create(
- FIND_MAIN_CLASS_TASK_NAME, FindMainClassTask.class);
+ FindMainClassTask findMainClassTask = project.getTasks()
+ .create(FIND_MAIN_CLASS_TASK_NAME, FindMainClassTask.class);
SourceSet mainSourceSet = SourceSets.findMainSourceSet(project);
if (mainSourceSet != null) {
findMainClassTask.setMainClassSourceSetOutput(mainSourceSet.getOutput());
@@ -64,15 +64,15 @@ public class RunPluginFeatures implements PluginFeatures {
}
private void addBootRunTask(final Project project) {
- final JavaPluginConvention javaConvention = project.getConvention().getPlugin(
- JavaPluginConvention.class);
+ final JavaPluginConvention javaConvention = project.getConvention()
+ .getPlugin(JavaPluginConvention.class);
BootRunTask run = project.getTasks().create(RUN_APP_TASK_NAME, BootRunTask.class);
run.setDescription("Run the project with support for "
+ "auto-detecting main class and reloading static resources");
run.setGroup("application");
- run.setClasspath(javaConvention.getSourceSets().findByName("main")
- .getRuntimeClasspath());
+ run.setClasspath(
+ javaConvention.getSourceSets().findByName("main").getRuntimeClasspath());
run.getConventionMapping().map("main", new Callable