I have a project on an old version (5.x) of gradle that publishes it’s tests fixtures as a separate maven artifact. (See gatk/build.gradle at master · broadinstitute/gatk · GitHub. It was not very easy to discover how to do that, using filters is a bizarre way to specify multiple publishing targets.) I was excited to switch it to use the new java-test-fixtures plugin, but it seems like it publishes the fixtures jar as a variant artifact with a shared pom. It makes the shared pom messy, and it’s hard to import the test fixtures jar as a dependency if the downstream project isn’t using gradle. The pom has the test-fixture dependencies included as optional, which means your downstream projects have to either import them manually or import all optional dependencies, both of which are not ideal.
I think it would be better if there was a mode where you could publish the test fixtures as a separate maven project.
Currently this is what gets published
org.company:project
org.company:project-test-fixtures
org.mycompany.project.pom.xml
What I would like is:
org.company:project
org.company:project.pom.xml
org.company:project-test-fixtures
org.company:project-test-fixtures.pom.xml
That way downstream projects can consume either the one they prefer and get the correct dependencies without having to muck with optional dependencies.
I think it makes more sense in general to consider the test fixtures a separate module that depend on the project rather than a variant of the project.
Is there a reasonable way to accomplish this right now using the test-fixtures plugin? It’s very nice to have preconfigured, standard, configurations, I just want to change how it’s published.