Skip to content

Conversation

@sandydunlop
Copy link

This adds support for the JPMS provides-with directive.

It has been found to be necessary while making SPI modules play nicely with JPMS, specifically with Hibernate.

An example from a real project:

module('com.github.gwenn:sqlite-dialect', 'org.hibernate.sqlite') {
    requires 'java.sql'
    requires 'org.hibernate.orm.core'
    provides 'org.hibernate.dialect.Dialect', 'org.hibernate.community.dialect.SQLiteDialect'
}

@jjohannes
Copy link
Member

Hi @sandydunlop. Thanks for your interest in contributing.

Note that SPI usually works via the plugin reading the information from META-INF/services.
https://github.com/gradlex-org/extra-java-module-info?tab=readme-ov-file#how-do-i-add-provides--with--declarations-to-the-module-infoclass-descriptor

Right now, you can only configure it to ignore certain things that are declared, but you cannot define additional provides. So I agree that this is a useful addition if the setup in the original Jar is somehow "broken". Which seems to be the case here for com.github.gwenn:sqlite-dialect (?).

To get this PR in, we would:

  • Need the implementation to be completed in ExtraJavaModuleInfoTransform.java. Probably by extending the code that writes the service providers here.
  • A test ideally showing the applicability on the example you have. The tests are written in Groovy/Spock, but you can use an existing test as basis. If you do not get this done completely, I can take it over once the general idea is there.

@jjohannes jjohannes added a:enhancement New feature or request pending:feedback Issues waiting for feedback from the reporter labels Dec 15, 2025
@testlens-app
Copy link

testlens-app bot commented Dec 15, 2025

✅ All tests passed ✅

🏷️ Commit: dbf3a78
▶️ Tests: 661 executed
⚪️ Checks: 1/1 completed


Learn more about TestLens at testlens.app.

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

Labels

a:enhancement New feature or request pending:feedback Issues waiting for feedback from the reporter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants