Quarkus: Gradle Plugin not working if module does not have main sourceSet

Created on 13 Aug 2020  路  5Comments  路  Source: quarkusio/quarkus

Describe the bug
Quarkus Version: 1.7.0.Final
Quarkus Gradle fails building the application because the plugin scans the workspace and retrieves the "main" sourceSet of all modules, but there is no "main" sourceSet in some modules.

For example: I have kotlin MPP submodules where there is a javaconvention but the javaconvention has no sourceSets.

Expected behavior
Should not fail.

Actual behavior
Build fails with:

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.tasks.QuarkusGradleUtils.getSourceSet(QuarkusGradleUtils.java:41)
        at io.quarkus.gradle.builder.QuarkusModelBuilder.getWorkspaceModule(QuarkusModelBuilder.java:121)
        at io.quarkus.gradle.builder.QuarkusModelBuilder.getWorkspace(QuarkusModelBuilder.java:113)
        at io.quarkus.gradle.builder.QuarkusModelBuilder.buildAll(QuarkusModelBuilder.java:100)
        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.QuarkusPluginExtension.getAppModelResolver(QuarkusPluginExtension.java:166)
        at io.quarkus.gradle.QuarkusPluginExtension_Decorated.getAppModelResolver(Unknown Source)
        at io.quarkus.gradle.tasks.QuarkusBuild.buildQuarkus(QuarkusBuild.java:97)
...

Suggestions for a fix:
I have several ideas to fix this problem:

  • Only scan modules that are related through dependencies to the module that is to be build.
  • Ignore modules which have no "main" sourceSet
  • Allow configuration of "to be excluded" sourceSets
  • Allow configuration of the "main" sourceSet for each module

I think the second one is the easiest to implement, but i have no idea about the impact it would have.

aregradle kinbug

Most helpful comment

Okay, i am on it

All 5 comments

/cc @quarkusio/devtools, @glefloch

This is actually making 1.7 not usable for our projekt. I can offer to help to fix this issue.

@antonwiens that would be great, we can make it in time for 1.7.1.Final then

I think it makes sense to ignore modules with no main sourceSet, option 2 in your list

Okay, i am on it

Was this page helpful?
0 / 5 - 0 ratings