This commit is contained in:
Phillip Webb
2014-01-02 12:04:45 -08:00
parent 0f9c705980
commit 1bcd3de7b5
31 changed files with 159 additions and 56 deletions

View File

@@ -43,8 +43,7 @@ public class SpringBootPlugin implements Plugin<Project> {
// register BootRepackage so that we can use
// task foo(type: BootRepackage) {}
project.getExtensions().getExtraProperties()
.set("BootRepackage", Repackage.class);
project.getExtensions().getExtraProperties().set("BootRepackage", Repackage.class);
Repackage packageTask = addRepackageTask(project);
ensureTaskRunsOnAssembly(project, packageTask);
addRunJarTask(project);

View File

@@ -1,3 +1,4 @@
package org.springframework.boot.gradle.task;
import java.io.File;
@@ -20,6 +21,7 @@ class ProjectLibraries implements Libraries {
private final Project project;
private String providedConfigurationName = "providedRuntime";
private String customConfigurationName = null;
/**
@@ -47,18 +49,16 @@ class ProjectLibraries implements Libraries {
@Override
public void doWithLibraries(LibraryCallback callback) throws IOException {
FileCollection custom = this.customConfigurationName != null ? this.project
.getConfigurations().findByName(this.customConfigurationName) : null;
FileCollection custom = this.customConfigurationName != null ? this.project.getConfigurations().findByName(
this.customConfigurationName)
: null;
if (custom != null) {
libraries(LibraryScope.CUSTOM, custom, callback);
}
else {
FileCollection compile = this.project.getConfigurations()
.getByName("compile");
} else {
FileCollection compile = this.project.getConfigurations().getByName("compile");
FileCollection runtime = this.project.getConfigurations()
.getByName("runtime");
FileCollection runtime = this.project.getConfigurations().getByName("runtime");
runtime = runtime.minus(compile);
FileCollection provided = this.project.getConfigurations().findByName(

View File

@@ -57,8 +57,7 @@ public class Repackage extends DefaultTask {
}
if (this.customConfiguration != null) {
libraries.setCustomConfigurationName(this.customConfiguration);
}
else if (extension.getCustomConfiguration() != null) {
} else if (extension.getCustomConfiguration() != null) {
libraries.setCustomConfigurationName(extension.getCustomConfiguration());
}
project.getTasks().withType(Jar.class, new Action<Jar>() {