Additional JAR file - variant versus classifier

I am working with the JakartaTransformer tool. It takes one jar file, performs transformations on its contents and saves those changes as another JAR file.

In particular, we are using it to apply transformation of the Hibernate ORM jars from the previous JPA contracts (javax.persistence package) to the new Jakarta EE persistence APIs (jakarta.persistence package).

I’d like to publish both of those artifacts. At the moment this is done by creating a whole new project (hibernate-core-jakarta) that depends on the “real” one (hibernate-core) and transforms the resolved dependency artifact file, publishing the transformed JAR as its artifact.

It seems like publishing the *-jakarta artifact would be better handled as a variant or classifier. I understand how to accomplish this via classifier, but the recommendation in the docs is to prefer module variants. What I am concerned with specifically is allowing users of build tools other than Gradle to be able to consume this transformed artifact. But I am completely lost how to do that.

How can library producers mix variants and classifiers such that users Gradle as well as other build tools can consume them?


Thinking about this some more, I do not think either will work for our needs. Part of what we need to do is to also transform our tests also to test the main artifact that we transformed.

In other words, we need to transform both the hibernate-core main classes and test classes to use the Jakarta APIs and be able to run both set of tests (transformed and un-transformed). We need to make sure the transformation worked properly. I have not seen any capability like that in Gradle, at least built-in. Granted, this is a quite special situation (though certainly not unique as all libraries using Java EE will need a similar transformation in the coming year or 2).