Repository: quarkusio/quarkus
Issue: gradle quarkus:dev task should be more lenient when analysing project dependencies

**Describe the bug**

It's a gradle multi module project with two projects

* application - kotlin jvm
* ui - kotlin js

The ui module produces a jar file with a `META-INF/resources` directory containing the web application (html, js, ..) and is linked
as project dependency to the application.

Gradle mentions that the ["preferred way"](https://docs.gradle.org/current/userguide/cross_project_publications.html) of sharing artifacts would be a custom configuration.

```
// application
plugins {
    id ("io.quarkus")
    kotlin ("jvm")
}

dependencies {
    implementation (project (":ui", configuration = "webpackjar"))
}

--------------------------------------------------------------------------------------------

// ui
plugins {
    kotlin ("js")
}

val webpackjar by configurations.creating {
    isCanBeConsumed = true
    isCanBeResolved = false
    attributes {
        attribute(Category.CATEGORY_ATTRIBUTE, namedAttribute(Category.LIBRARY))
        attribute(Bundling.BUNDLING_ATTRIBUTE, namedAttribute(Bundling.EXTERNAL))
        attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, JavaVersion.current().majorVersion.toInt())
        attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, namedAttribute(LibraryElements.JAR))
        attribute(Usage.USAGE_ATTRIBUTE, namedAttribute(Usage.JAVA_RUNTIME))
        attribute(KotlinPlatformType.attribute, KotlinPlatformType.jvm)
    }
}

artifacts {
    add("webpackjar", jar)
}
```

It seems that the java convention plugin is somehow active in the ui module, which leads to an exception that is shown below. 

The build succeeds otherwise, e.g `quarkus:build`

Extending the guard `if (javaConvention != null) {` with an additional check would solve this issue.

**Expected behavior**

`quarkus:dev` task should not abort if the main sourceset can't be resolved from the java convention plugin

**Actual behavior**

```
Caused by: org.gradle.api.UnknownDomainObjectException: SourceSet with name 'main' not found.
	at org.gradle.api.internal.DefaultNamedDomainObjectCollection.createNotFoundException(DefaultNamedDomainObjectCollection.java:504)
	at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:333)
	at io.quarkus.gradle.builder.QuarkusModelBuilder.addDevModePaths(QuarkusModelBuilder.java:297)
	at io.quarkus.gradle.builder.QuarkusModelBuilder.collectDependencies(QuarkusModelBuilder.java:254)
	at io.quarkus.gradle.builder.QuarkusModelBuilder.buildAll(QuarkusModelBuilder.java:94)
	at io.quarkus.gradle.QuarkusPluginExtension.create(QuarkusPluginExtension.java:185)
	at io.quarkus.gradle.QuarkusPluginExtension.getQuarkusModel(QuarkusPluginExtension.java:178)
	at io.quarkus.gradle.QuarkusPluginExtension.getAppModelResolver(QuarkusPluginExtension.java:170)
	at io.quarkus.gradle.tasks.QuarkusDev.startDev(QuarkusDev.java:285)
```


**Environment (please complete the following information):**
 - Output of `uname -a` or `ver`: windows
 - Output of `java -version`: openjdk version "11.0.6" 2020-01-14
 - GraalVM version (if different from Java): ---
 - Quarkus version or git rev: 1.8.3
 - Build tool (ie. output of `mvnw --version` or `gradlew --version`): Gradle 6.6.1



Changed files:
devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java, devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java

diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java b/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java
index f20810505e4..8252e293e55 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java
@@ -296,25 +296,29 @@ private void collectDependencies(ResolvedConfiguration configuration,
 
     private void addDevModePaths(final DependencyImpl dep, ResolvedArtifact a, Project project) {
         final JavaPluginConvention javaConvention = project.getConvention().findPlugin(JavaPluginConvention.class);
-        if (javaConvention != null) {
-            SourceSet mainSourceSet = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
-            final File classesDir = new File(QuarkusGradleUtils.getClassesDir(mainSourceSet, project.getBuildDir(), false));
-            if (classesDir.exists()) {
-                dep.addPath(classesDir);
-            }
-            for (File resourcesDir : mainSourceSet.getResources().getSourceDirectories()) {
-                if (resourcesDir.exists()) {
-                    dep.addPath(resourcesDir);
+        if (javaConvention == null) {
+            dep.addPath(a.getFile());
+        } else {
+            SourceSet mainSourceSet = javaConvention.getSourceSets().findByName(SourceSet.MAIN_SOURCE_SET_NAME);
+            if (mainSourceSet != null) {
+                final File classesDir = new File(QuarkusGradleUtils.getClassesDir(mainSourceSet, project.getBuildDir(), false));
+                if (classesDir.exists()) {
+                    dep.addPath(classesDir);
                 }
-            }
-            for (File outputDir : project.getTasks().findByName(JavaPlugin.PROCESS_RESOURCES_TASK_NAME)
-                    .getOutputs().getFiles()) {
-                if (outputDir.exists()) {
-                    dep.addPath(outputDir);
+                for (File resourcesDir : mainSourceSet.getResources().getSourceDirectories()) {
+                    if (resourcesDir.exists()) {
+                        dep.addPath(resourcesDir);
+                    }
                 }
+                for (File outputDir : project.getTasks().findByName(JavaPlugin.PROCESS_RESOURCES_TASK_NAME)
+                        .getOutputs().getFiles()) {
+                    if (outputDir.exists()) {
+                        dep.addPath(outputDir);
+                    }
+                }
+            } else {
+                dep.addPath(a.getFile());
             }
-        } else {
-            dep.addPath(a.getFile());
         }
     }
 
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 7aedaa6b806..501b8f7dc92 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
@@ -420,7 +420,10 @@ private void addLocalProject(Project project, DevModeContext context, Set<AppArt
         }
 
         SourceSetContainer sourceSets = javaConvention.getSourceSets();
-        SourceSet mainSourceSet = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME);
+        SourceSet mainSourceSet = sourceSets.findByName(SourceSet.MAIN_SOURCE_SET_NAME);
+        if (mainSourceSet == null) {
+            return;
+        }
         Set<String> sourcePaths = new HashSet<>();
         Set<String> sourceParentPaths = new HashSet<>();