Add AOT-generated classes to classpath of the compiler

See gh-32304
This commit is contained in:
Stephane Nicoll
2022-09-13 14:58:16 +02:00
parent 867c49337a
commit 88f2b33cc1
3 changed files with 5 additions and 4 deletions

View File

@@ -137,10 +137,11 @@ public abstract class AbstractAotMojo extends AbstractDependencyFilterMojo {
}
}
protected final URL[] getClassPath(File classesDirectory, ArtifactsFilter... artifactFilters)
throws MojoExecutionException {
protected final URL[] getClassPath(File classesDirectory, File generatedClassesDirectory,
ArtifactsFilter... artifactFilters) throws MojoExecutionException {
List<URL> urls = new ArrayList<>();
urls.add(toURL(classesDirectory));
urls.add(toURL(generatedClassesDirectory));
urls.addAll(getDependencyURLs(artifactFilters));
return urls.toArray(URL[]::new);
}

View File

@@ -107,7 +107,7 @@ public class ProcessAotMojo extends AbstractAotMojo {
}
protected URL[] getClassPath() throws Exception {
return getClassPath(this.classesDirectory, new ExcludeTestScopeArtifactFilter());
return getClassPath(this.classesDirectory, this.generatedClasses, new ExcludeTestScopeArtifactFilter());
}
}

View File

@@ -133,7 +133,7 @@ public class ProcessTestAotMojo extends AbstractAotMojo {
}
protected URL[] getClassPath(boolean includeJUnitPlatformLauncher) throws Exception {
URL[] classPath = getClassPath(this.classesDirectory);
URL[] classPath = getClassPath(this.classesDirectory, this.generatedClasses);
if (!includeJUnitPlatformLauncher || this.project.getArtifactMap()
.containsKey(JUNIT_PLATFORM_GROUP_ID + ":" + JUNIT_PLATFORM_LAUNCHER_ARTIFACT_ID)) {
return classPath;