Require single main class
Update run tasks to ensure that only a single main class is required when performing a class search. See gh-886
This commit is contained in:
@@ -29,7 +29,7 @@ import org.springframework.boot.loader.tools.MainClassFinder;
|
||||
|
||||
/**
|
||||
* Add a main class if one is missing from the build
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class ComputeMain implements Action<Task> {
|
||||
@@ -68,7 +68,7 @@ public class ComputeMain implements Action<Task> {
|
||||
project.getLogger().debug(
|
||||
"Looking for main in: " + main.getOutput().getClassesDir());
|
||||
try {
|
||||
String mainClass = MainClassFinder.findMainClass(main.getOutput()
|
||||
String mainClass = MainClassFinder.findSingleMainClass(main.getOutput()
|
||||
.getClassesDir());
|
||||
project.getLogger().info("Computed main class: " + mainClass);
|
||||
return mainClass;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class RunApp extends DefaultTask {
|
||||
}
|
||||
getLogger().info("Looking for main in: " + main.getOutput().getClassesDir());
|
||||
try {
|
||||
return MainClassFinder.findMainClass(main.getOutput().getClassesDir());
|
||||
return MainClassFinder.findSingleMainClass(main.getOutput().getClassesDir());
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IllegalStateException("Cannot find main class", ex);
|
||||
|
||||
Reference in New Issue
Block a user