From 709db5582b14e7092ff4901715da8aefffcff936 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 9 Apr 2021 17:45:38 +0100 Subject: [PATCH] Ensure that classes and resources are in place before documenting Closes gh-25948 --- .../boot/build/autoconfigure/AutoConfigurationPlugin.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/autoconfigure/AutoConfigurationPlugin.java b/buildSrc/src/main/java/org/springframework/boot/build/autoconfigure/AutoConfigurationPlugin.java index 65dd86dabb..bd3bbd2cdb 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/autoconfigure/AutoConfigurationPlugin.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/autoconfigure/AutoConfigurationPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright 2019-2020 the original author or authors. + * Copyright 2019-2021 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. @@ -66,8 +66,10 @@ public class AutoConfigurationPlugin implements Plugin { .add(project.getDependencies().project(Collections.singletonMap("path", ":spring-boot-project:spring-boot-tools:spring-boot-configuration-processor"))); project.getTasks().create("autoConfigurationMetadata", AutoConfigurationMetadata.class, (task) -> { - task.setSourceSet(project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets() - .getByName(SourceSet.MAIN_SOURCE_SET_NAME)); + SourceSet main = project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets() + .getByName(SourceSet.MAIN_SOURCE_SET_NAME); + task.setSourceSet(main); + task.dependsOn(main.getClassesTaskName()); task.setOutputFile(new File(project.getBuildDir(), "auto-configuration-metadata.properties")); project.getArtifacts().add(AutoConfigurationPlugin.AUTO_CONFIGURATION_METADATA_CONFIGURATION_NAME, project.provider((Callable) task::getOutputFile), (artifact) -> artifact.builtBy(task));