|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright 2012-2017 the original author or authors.
|
|
|
|
|
* Copyright 2012-2018 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.
|
|
|
|
@ -22,6 +22,7 @@ import java.util.Objects;
|
|
|
|
|
import java.util.concurrent.Callable;
|
|
|
|
|
import java.util.function.Supplier;
|
|
|
|
|
|
|
|
|
|
import org.gradle.api.InvalidUserDataException;
|
|
|
|
|
import org.gradle.api.Project;
|
|
|
|
|
import org.gradle.api.file.FileCollection;
|
|
|
|
|
|
|
|
|
@ -66,7 +67,8 @@ final class MainClassConvention implements Callable<Object> {
|
|
|
|
|
private String resolveMainClass() {
|
|
|
|
|
return this.classpathSupplier.get().filter(File::isDirectory).getFiles().stream()
|
|
|
|
|
.map(this::findMainClass).filter(Objects::nonNull).findFirst()
|
|
|
|
|
.orElse(null);
|
|
|
|
|
.orElseThrow(() -> new InvalidUserDataException(
|
|
|
|
|
"Main class name has not been configured and it could not be resolved"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String findMainClass(File file) {
|
|
|
|
|