Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle Plugin not working if module does not have main sourceSet #11370

Closed
antonwiens opened this issue Aug 13, 2020 · 5 comments · Fixed by #11374
Closed

Gradle Plugin not working if module does not have main sourceSet #11370

antonwiens opened this issue Aug 13, 2020 · 5 comments · Fixed by #11374
Assignees
Labels
area/gradle Gradle kind/bug Something isn't working
Milestone

Comments

@antonwiens
Copy link

antonwiens commented Aug 13, 2020

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.

@antonwiens antonwiens added the kind/bug Something isn't working label Aug 13, 2020
@quarkusbot quarkusbot added the area/gradle Gradle label Aug 13, 2020
@quarkusbot
Copy link

/cc @quarkusio/devtools, @glefloch

@antonwiens
Copy link
Author

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

@gastaldi
Copy link
Contributor

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

@gastaldi
Copy link
Contributor

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

@antonwiens
Copy link
Author

Okay, i am on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants