mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Merge branch '4.0.x'
Closes gh-50637
This commit is contained in:
+11
-10
@@ -141,17 +141,18 @@ public abstract class ArchitectureCheck extends DefaultTask {
|
||||
|
||||
private void withCompileClasspath(Callable<?> callable) throws Exception {
|
||||
ClassLoader previous = Thread.currentThread().getContextClassLoader();
|
||||
try {
|
||||
List<URL> urls = new ArrayList<>();
|
||||
for (File file : getCompileClasspath().getFiles()) {
|
||||
urls.add(file.toURI().toURL());
|
||||
}
|
||||
ClassLoader classLoader = new URLClassLoader(urls.toArray(new URL[0]), getClass().getClassLoader());
|
||||
Thread.currentThread().setContextClassLoader(classLoader);
|
||||
callable.call();
|
||||
List<URL> urls = new ArrayList<>();
|
||||
for (File file : getCompileClasspath().getFiles()) {
|
||||
urls.add(file.toURI().toURL());
|
||||
}
|
||||
finally {
|
||||
Thread.currentThread().setContextClassLoader(previous);
|
||||
try (URLClassLoader classLoader = new URLClassLoader(urls.toArray(new URL[0]), getClass().getClassLoader())) {
|
||||
Thread.currentThread().setContextClassLoader(classLoader);
|
||||
try {
|
||||
callable.call();
|
||||
}
|
||||
finally {
|
||||
Thread.currentThread().setContextClassLoader(previous);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user