From 26038d1b002ed02692a37a6c6156fea243f870eb Mon Sep 17 00:00:00 2001 From: Markus Heiden Date: Tue, 8 Jun 2021 01:01:06 +0200 Subject: [PATCH] HHH-14657 Use the compile instead of runtime classpath The runtime classpath contains the dependencies as jars that are not yet built when the plugin needs them. So use the compile classpath plus the compiled classes of the current project. --- .../org/hibernate/orm/tooling/gradle/EnhancementHelper.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tooling/hibernate-gradle-plugin/src/main/groovy/org/hibernate/orm/tooling/gradle/EnhancementHelper.java b/tooling/hibernate-gradle-plugin/src/main/groovy/org/hibernate/orm/tooling/gradle/EnhancementHelper.java index 85982c8c5b..2afc97d04f 100644 --- a/tooling/hibernate-gradle-plugin/src/main/groovy/org/hibernate/orm/tooling/gradle/EnhancementHelper.java +++ b/tooling/hibernate-gradle-plugin/src/main/groovy/org/hibernate/orm/tooling/gradle/EnhancementHelper.java @@ -37,6 +37,11 @@ import org.hibernate.cfg.Environment; */ public class EnhancementHelper { static void enhance(SourceSet sourceSet, EnhanceExtension options, Project project) { + // The compile classpath contains the jar dependencies and + // the output directories with the compiled classes of project dependencies in a multi-project build. + // The classes directories contain the compiled classes of this project. + // The runtime classpath cannot be used for this purpose + // because it contains the jars of project dependencies which are not yet built. final ClassLoader classLoader = toClassLoader( sourceSet.getCompileClasspath(), sourceSet.getOutput().getClassesDirs() ); final EnhancementContext enhancementContext = new DefaultEnhancementContext() {