Repository: quarkusio/quarkus
Issue: GRPC: Does not generate proto-based files

### Describe the bug

version 2.5 gradle+scala+grpc do not generate code from my proto files
version 2.4.1.Final gradle+scala+grpc generates code from my proto files

### Expected behavior

java code based on my proto files is generate

### Actual behavior

java files are not generated

### How to Reproduce?

1. generate project using scala, grpc, gradle, v. 2.4.1
1. create source file src/main/proto/helloworld.proto
  ```
    syntax = "proto3";
    package helloworld;
    message Hello {
      string message = 1;
    }
  ```
1. gradle clean build
1. find . -name *.java
   - actual: The list contains just generated Helloworld.java file
1. Repeat the same steps using Quarkus v. 2.5
1. find . -name *.java
   - expected: The list contains Helloworld.java file
   - actual: the list is empty


### Output of `uname -a` or `ver`

Linux Home1 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

### Output of `java -version`

openjdk version "17.0.1" 2021-10-19 LTS OpenJDK Runtime Environment Microsoft-28056 (build 17.0.1+12-LTS) OpenJDK 64-Bit Server VM Microsoft-28056 (build 17.0.1+12-LTS, mixed mode, sharing)

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.5.0.Final

### Build tool (ie. output of `mvnw --version` or `gradlew --version`)

Gradle 7.2

### Additional information

_No response_

Changed files:
integration-tests/gradle/src/test/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java
devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java

diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
index 6445b0894d2..c2860d18b4e 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
@@ -177,6 +177,7 @@ public void execute(Task test) {
                             });
                     tasks.named(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME, JavaCompile.class,
                             compileTestJava -> {
+                                compileTestJava.dependsOn(quarkusGenerateCode);
                                 compileTestJava.dependsOn(quarkusGenerateCodeTests);
                                 if (project.getGradle().getStartParameter().getTaskNames().contains(QUARKUS_DEV_TASK_NAME)) {
                                     compileTestJava.getOptions().setFailOnError(false);
diff --git a/integration-tests/gradle/src/test/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java b/integration-tests/gradle/src/test/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java
index bfc8c6d2514..fa25471402d 100644
--- a/integration-tests/gradle/src/test/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java
+++ b/integration-tests/gradle/src/test/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java
@@ -151,6 +151,16 @@ public void canRunTest() throws Exception {
         assertThat(buildResult.getTasks().get(":test")).isEqualTo(BuildResult.SUCCESS_OUTCOME);
     }
 
+    @Test
+    public void generateCodeBeforeTests() throws Exception {
+        createProject(SourceType.JAVA);
+
+        BuildResult firstBuild = runGradleWrapper(projectRoot, "test", "--stacktrace");
+        assertThat(firstBuild.getOutput()).contains("Task :quarkusGenerateCode");
+        assertThat(firstBuild.getOutput()).contains("Task :quarkusGenerateCodeTests");
+        assertThat(firstBuild.getTasks().get(":test")).isEqualTo(BuildResult.SUCCESS_OUTCOME);
+    }
+
     private void createProject(SourceType sourceType) throws Exception {
         Map<String, Object> context = new HashMap<>();
         context.put("path", "/greeting");