Updates that have been required in order to use Maven test framework v241.15989.150:
protected List<Module> createMavenModules(List<File> projectDirs) throws Exception {
Project project = getTestFixture().getProject();
List<VirtualFile> pomFiles = new ArrayList<>();
for (File projectDir : projectDirs) {
File moduleDir = new File(project.getBasePath(), projectDir.getName() + counter.getAndIncrement());
FileUtils.copyDirectory(projectDir, moduleDir);
VirtualFile pomFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(moduleDir).findFileByRelativePath("pom.xml");
pomFiles.add(pomFile);
}
// Make a blocking call to the Kotlin suspend function: importProjectsAsync().
BuildersKt.runBlocking(
EmptyCoroutineContext.INSTANCE,
(scope, continuation) -> importProjectsAsync(pomFiles.toArray(VirtualFile[]::new), continuation)
);
Module[] modules = ModuleManager.getInstance(getTestFixture().getProject()).getModules();
for (Module module : modules) {
setupJdkForModule(module.getName());
}
// REVISIT: After calling setupJdkForModule() initialization appears to continue in the background
// and a may cause a test to intermittently fail if it accesses the module too early. A 10-second wait
// is hopefully long enough but would be preferable to synchronize on a completion event if one is
// ever introduced in the future.
Thread.sleep(10000L);
return Arrays.asList(modules).stream().skip(1).collect(Collectors.toList());
}
Changes to the Maven test framework have driven us to make several updates to the base Jakarta EE test class:
We should revisit the decision to use Thread.sleep() when creating the Maven module and hopefully find a better solution.
Original code borrowed from Quarkus Tools:
Updates that have been required in order to use Maven test framework v241.15989.150: