Skip to content

Gradle: Allow setting custom sourceset #4316

Description

@stashymane

Environment:

  • Jib version: 3.4.3
  • Build tool: Gradle 8.7

Description of the issue:
Currently, the main sourceset is hardcoded into the gradle plugin. With the default Java plugin this works well, however running anything else makes using Jib difficult.
My use-case is Kotlin Multiplatform - it does generate a JVM target, however it does not create a main sourceset. This results in Jib throwing an exception:

org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':server'.
Caused by: org.gradle.api.UnknownDomainObjectException: SourceSet with name 'main' not found.
	at com.google.cloud.tools.jib.gradle.JibPlugin.lambda$apply$9(JibPlugin.java:189)

Having to manually set up the main sourceset as a "mirror" is error-prone and cumbersome. A very simple choice of sourceset in the Jib configuration would solve most issues.

This exact issue was already mentioned in #1778, and even though the issue was closed, only the configuration was allowed to be configurable. The sourceset still isn't.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions