Capabilities added by the Java(Library)Plugin

TLDR; Is there a way to apply the various Configuration-related configuration done by the Java(Library)Plugin without actually applying the Java(Library)Plugin? Or is there at least a document somewhere that illustrates the configuration I need to apply to the Configurations I create?

Following up on Dependency & variant selection (as done in JavaPlugin)

The gist is that I have a project which looks like a Java project in terms of artifacts it produces but which contains no sources. It takes another project’s main, sources and javadoc jar, runs them through a transformation and then publishes those transformed artifacts.

I am left with a choice - either apply the Java(Library)Plugin and “undo” some of what it does (disable various tasks, etc) or do not apply the Java(Library)Plugin and manually handle all of the creation and wiring that the Java(Library)Plugin does. Conceptually, in my opinion, this project does not match the conventions of a java(-library) because of the no-source aspect.

Initially I took the approach of applying the Java(Library)Plugin and undoing some of its work. But I started having problems (I forget the details at this point) because much of what Java(Library)Plugin does expects sources.

Because of that (and really in my opinion, this project does not match the conventions of a java(-library) because of the no-source aspect) I started working on the second approach. This worked fine except for a few cases. One example of this can be seen in the linked forum post, which dealt with incoming Configurations. I am now also having lots of difficulty figuring out how to properly configure outgoing Configurations and publishing.

For that specifically, any pointers on how to properly define the publication for a project?

In the larger scope, is there a way to apply the various Configuration-related configuration done by the Java(Library)Plugin without actually applying the Java(Library)Plugin? Or is there at least a document somewhere that illustrates the configuration I need to apply to the Configurations I create?

FWIW, at moment I create all of api, implementation, compileOnly (not really used), runtimeOnly, runtimeClasspath, testImplementation, testRuntimeOnly, testRuntimeClasspath. I also created Configurations named apiElements and runtimeElements mainly (1) to help with POM definition and (2) for “completeness”. It them creates a number of transformation tasks. I also create a Test task and wire it up (the project also transforms the “source project”'s tests and runs them) which depends on the transformation tasks. Again, this all works fine/great. The problems I have atm all relate to Configurations and Publications.

That is a lot to read and I thank y’all in advance for reading all the way here :slight_smile: