Repository: quarkusio/quarkus
Issue: Quarkus 2.0.0.Alpha2 continous testing not working with kotlin kapt plugin

## Describe the bug
My code uses the kotlin arrow lib which can optionally use kotlin kapt. Continous testing in quarkus 2.0.0.Alpha2 does not work with kapt enabled but it works with quarkus 1.13.4.Final.


### Expected behavior
continous testing will work fine with kapt.

### Actual behavior
Continous testing fails with following error:
```
2021-05-16 11:52:43,714 INFO  [io.quarkus] (Quarkus Main Thread) kaptbug 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.0.0.Alpha2) started in 3.239s. Listening on: http://localhost:8080
2021-05-16 11:52:43,721 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-05-16 11:52:43,721 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, kotlin, smallrye-context-propagation]
2021-05-16 11:52:43,721 INFO  [quarkus] (Quarkus Main Thread) Tests paused, press [r] to resume
r
2021-05-16 11:52:47,847 INFO  [quarkus] (Quarkus Terminal Reader) Running Tests for the first time
2021-05-16 11:52:48,047 INFO  [quarkus] (Test runner thread) Running 0/1.
2021-05-16 11:52:48,125 ERROR [io.qua.test] (Test runner thread) Test GreetingResourceTest#testHelloEndpoint() failed 
: java.lang.RuntimeException: java.lang.RuntimeException: The test class class org.acme.GreetingResourceTest is not located in any of the directories [classes\\java\\native-integrationTest, classes\\scala\\integration-test, \\test-classes, classes\\kotlin\\native-integration-test, classes\\kotlin\\native-integrationTest, classes\\scala\\integrationTest, classes\\kotlin\\test, classes\\kotlin\\native-test, classes\\java\\native-integration-test, classes\\java\\native-test, classes\\java\\test, classes\\java\\integration-test, classes\\scala\\test, out\\test, classes\\kotlin\\integration-test, classes\\kotlin\\integrationTest, classes\\scala\\native-integrationTest, bin\\test, classes\\java\\integrationTest, classes\\scala\\native-integration-test, classes\\scala\\native-test]
	at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:693)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:766)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestClassConstructor(InvocationInterceptor.java:72)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:77)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestClassConstructor(ClassBasedTestDescriptor.java:342)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateTestClass(ClassBasedTestDescriptor.java:289)
	at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateTestClass(ClassTestDescriptor.java:79)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:267)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$2(ClassBasedTestDescriptor.java:259)
	at java.base/java.util.Optional.orElseGet(Optional.java:369)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$3(ClassBasedTestDescriptor.java:258)
	at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:101)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:100)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:65)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$1(NodeTestTask.java:111)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:111)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:79)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:84)
	at io.quarkus.deployment.dev.testing.JunitTestRunner.runTests(JunitTestRunner.java:202)
	at io.quarkus.deployment.dev.testing.TestRunner.runInternal(TestRunner.java:242)
	at io.quarkus.deployment.dev.testing.TestRunner$1.run(TestRunner.java:125)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: The test class class org.acme.GreetingResourceTest is not located in any of the directories [classes\\java\\native-integrationTest, classes\\scala\\integration-test, \\test-classes, classes\\kotlin\\native-integration-test, classes\\kotlin\\native-integrationTest, classes\\scala\\integrationTest, classes\\kotlin\\test, classes\\kotlin\\native-test, classes\\java\\native-integration-test, classes\\java\\native-test, classes\\java\\test, classes\\java\\integration-test, classes\\scala\\test, out\\test, classes\\kotlin\\integration-test, classes\\kotlin\\integrationTest, classes\\scala\\native-integrationTest, bin\\test, classes\\java\\integrationTest, classes\\scala\\native-integration-test, classes\\scala\\native-test]
	at io.quarkus.test.common.PathTestHelper.getTestClassesLocation(PathTestHelper.java:145)
	at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:207)
	at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:661)
	at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:708)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$8(ClassBasedTestDescriptor.java:368)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:368)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:192)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:78)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:136)
	... 31 more
```


## To Reproduce
[A small reproducer](https://github.com/alexander-dammeier/quarkus-2-alpha2-kaptbug)

This is only a project with resteasy, kotlin and gradle from your start coding website. I manually updated to quarkus2.0.0.Alpha2 and added the arrow and kapt dependency.
You can simply remove the kapt plugin and the arrow-kapt dependency from the build.gradle file and it will work just fine.

## Environment:

### Output of `uname -a` or `ver`
`Microsoft Windows [Version 10.0.19042.985]`

The bug also occures in debian in wsl2:
`Linux 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 GNU/Linux`
### Output of `java -version`
```
java 11.0.1 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
```
### GraalVM version
not installed

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
```
------------------------------------------------------------
Gradle 6.8.3
------------------------------------------------------------

Build time:   2021-02-22 16:13:28 UTC
Revision:     9e26b4a9ebb910eaa1b8da8ff8575e514bc61c78

Kotlin:       1.4.20
Groovy:       2.5.12
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          11.0.9.1 (Debian 11.0.9.1+1-post-Debian-1deb10u2)
OS:           Linux 4.19.128-microsoft-standard amd64
```
## Additional context
The error says nothing about kapt so it took me a while to isolate this bug. I have about 100 kotlin files in my project and i found no pattern which file will occur this error. Maybe it is just the first kotlin file quarkus tries to load.
Hope it helps. Keep up the great work!


Changed files:
devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
test-framework/common/src/main/java/io/quarkus/test/common/PathTestHelper.java
devtools/gradle/src/main/java/io/quarkus/gradle/extension/QuarkusPluginExtension.java
devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGradleUtils.java

diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/extension/QuarkusPluginExtension.java b/devtools/gradle/src/main/java/io/quarkus/gradle/extension/QuarkusPluginExtension.java
index 14a9b066923..203546f978a 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/extension/QuarkusPluginExtension.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/extension/QuarkusPluginExtension.java
@@ -112,7 +112,7 @@ public Path appJarOrClasses() {
             JavaPluginConvention javaConvention = convention.findPlugin(JavaPluginConvention.class);
             if (javaConvention != null) {
                 final SourceSet mainSourceSet = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
-                final String classesPath = QuarkusGradleUtils.getClassesDir(mainSourceSet, jarTask.getTemporaryDir());
+                final String classesPath = QuarkusGradleUtils.getClassesDir(mainSourceSet, jarTask.getTemporaryDir(), false);
                 if (classesPath != null) {
                     classesDir = Paths.get(classesPath);
                 }
diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
index f49b481eb38..61193bc33db 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
@@ -378,7 +378,7 @@ private void addLocalProject(Project project, GradleDevModeLauncher.Builder buil
             return;
         }
 
-        String classesDir = QuarkusGradleUtils.getClassesDir(mainSourceSet, project.getBuildDir());
+        String classesDir = QuarkusGradleUtils.getClassesDir(mainSourceSet, project.getBuildDir(), false);
         if (classesDir == null) {
             return;
         } else {
@@ -429,7 +429,7 @@ private void addLocalProject(Project project, GradleDevModeLauncher.Builder buil
             final File testResourcesOutputDir = testSourceSet.getOutput().getResourcesDir();
 
             if (!testSourcePaths.isEmpty() || (testResourcesOutputDir != null && testResourcesOutputDir.exists())) {
-                String testClassesDir = QuarkusGradleUtils.getClassesDir(testSourceSet, project.getBuildDir());
+                String testClassesDir = QuarkusGradleUtils.getClassesDir(testSourceSet, project.getBuildDir(), true);
                 if (testClassesDir != null) {
                     File testClassesDirFile = new File(testClassesDir);
                     if (testClassesDirFile.exists()) {
diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGradleUtils.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGradleUtils.java
index 99dcdc0c2a1..b83875b915c 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGradleUtils.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGradleUtils.java
@@ -56,17 +56,16 @@ public static PathsCollection getOutputPaths(Project project) {
         return builder.build();
     }
 
-    public static String getClassesDir(SourceSet sourceSet, File tmpDir) {
-        return getClassesDir(sourceSet, tmpDir, true);
+    public static String getClassesDir(SourceSet sourceSet, File tmpDir, boolean test) {
+        return getClassesDir(sourceSet, tmpDir, true, test);
     }
 
-    public static String getClassesDir(SourceSet sourceSet, File tmpDir, boolean populated) {
+    public static String getClassesDir(SourceSet sourceSet, File tmpDir, boolean populated, boolean test) {
         FileCollection classesDirs = sourceSet.getOutput().getClassesDirs();
         Set<File> classDirFiles = classesDirs.getFiles();
         if (classDirFiles.size() == 1) {
             return classesDirs.getAsPath();
         }
-
         Path classesDir = null;
         final Iterator<File> i = classDirFiles.iterator();
         int dirCount = 0;
@@ -84,7 +83,7 @@ public static String getClassesDir(SourceSet sourceSet, File tmpDir, boolean pop
                         //there does not seem to be any sane way of dealing with multiple output dirs, as there does not seem
                         //to be a way to map them. We will need to address this at some point, but for now we just stick them
                         //all in a temp dir
-                        final Path tmpClassesDir = tmpDir.toPath().resolve("quarkus-app-classes");
+                        final Path tmpClassesDir = tmpDir.toPath().resolve("quarkus-app-classes" + (test ? "-test" : ""));
                         if (!populated) {
                             return tmpClassesDir.toString();
                         }
diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/PathTestHelper.java b/test-framework/common/src/main/java/io/quarkus/test/common/PathTestHelper.java
index a6baf03b844..0ada8916845 100644
--- a/test-framework/common/src/main/java/io/quarkus/test/common/PathTestHelper.java
+++ b/test-framework/common/src/main/java/io/quarkus/test/common/PathTestHelper.java
@@ -53,6 +53,9 @@ public final class PathTestHelper {
         TEST_TO_MAIN_DIR_FRAGMENTS.put(
                 "classes" + File.separator + "java" + File.separator + "native-integration-test",
                 "classes" + File.separator + "java" + File.separator + "main");
+        TEST_TO_MAIN_DIR_FRAGMENTS.put( //synthetic tmp dirs when there are multiple outputs
+                "quarkus-app-classes-test",
+                "quarkus-app-classes");
         //endregion
         //region Kotlin
         TEST_TO_MAIN_DIR_FRAGMENTS.put(