Repository: quarkusio/quarkus
Issue: Gradle MulitModule Project: quarkusGenerateCodeTests: java.lang.NullPointerException

### Describe the bug

on my [project](https://github.com/tower-projects/tower-web-template)
use quarkus 2.2.1.Final,can be start success
but,when upgrade to 2.4.0.Final to build has exception

```
Caused by: java.lang.NullPointerException
        at io.quarkus.gradle.builder.GradleApplicationModelBuilder.initProjectModule(GradleApplicationModelBuilder.java:487)
        at io.quarkus.gradle.builder.GradleApplicationModelBuilder.initProjectModuleAndBuildPaths(GradleApplicationModelBuilder.java:443)
        at io.quarkus.gradle.builder.GradleApplicationModelBuilder.collectDependencies(GradleApplicationModelBuilder.java:393)
        at io.quarkus.gradle.builder.GradleApplicationModelBuilder.lambda$collectDependencies$5(GradleApplicationModelBuilder.java:320)
        at io.quarkus.gradle.builder.GradleApplicationModelBuilder.collectDependencies(GradleApplicationModelBuilder.java:320)
        at io.quarkus.gradle.builder.GradleApplicationModelBuilder.buildAll(GradleApplicationModelBuilder.java:160)
        at io.quarkus.gradle.extension.QuarkusPluginExtension.create(QuarkusPluginExtension.java:217)
        at io.quarkus.gradle.extension.QuarkusPluginExtension.getApplicationModel(QuarkusPluginExtension.java:211)
        at io.quarkus.gradle.tasks.QuarkusGenerateCode.prepareQuarkus(QuarkusGenerateCode.java:91)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

```

### Expected behavior

_No response_

### Actual behavior

_No response_

### How to Reproduce?

1.clone my project
git@github.com:tower-projects/tower-web-template.git
2. exec:
./gradlew clean quarkusDev -p server --stacktrace -x test

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

_No response_

### Output of `java -version`

_No response_

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

_No response_

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

_No response_

### Additional information

_No response_

Changed files:
devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java

diff --git a/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java b/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java
index 5d4c13ba673..4b4f3a9a742 100644
--- a/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java
+++ b/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java
@@ -178,7 +178,6 @@ public static ResolvedDependency getProjectArtifact(Project project, LaunchMode
         final DefaultWorkspaceModule mainModule = new DefaultWorkspaceModule(
                 new GAV(appArtifact.getGroupId(), appArtifact.getArtifactId(), appArtifact.getVersion()),
                 project.getProjectDir(), project.getBuildDir());
-
         initProjectModule(project, mainModule, javaConvention.getSourceSets().findByName(SourceSet.MAIN_SOURCE_SET_NAME),
                 false);
         if (mode.equals(LaunchMode.TEST)) {
@@ -479,12 +478,17 @@ private void processQuarkusDependency(ResolvedDependencyBuilder artifactBuilder,
 
     private static void initProjectModule(Project project, DefaultWorkspaceModule module, SourceSet sourceSet, boolean test) {
 
+        if (sourceSet == null) {
+            return;
+        }
+
         module.setBuildFiles(PathList.of(project.getBuildFile().toPath()));
 
         final FileCollection allClassesDirs = sourceSet.getOutput().getClassesDirs();
         // some plugins do not add source directories to source sets and they may be missing from sourceSet.getAllJava()
         // see https://github.com/quarkusio/quarkus/issues/20755
         final TaskCollection<AbstractCompile> compileTasks = project.getTasks().withType(AbstractCompile.class);
+
         compileTasks.forEach(t -> {
             if (!t.getEnabled()) {
                 return;