Publishing test fixtures does not require any particular configuration of the publication. However, the capability mechanism used to handle fixtures requires an additional configuration.
For a given artifact with coordinates
expects that the test fixtures artifact declares a capability with coordinates
groupId:artifactId-test-fixtures:version. This is not currently done
automatically by either the test fixture support or the Maven Publish Plugin,
and therefore must be done manually.
Gradle creates the capability from the project’s name, group, and version.
All three must be set up to match the
in the publication.
The project’s name is the last segment of its path by default; so the default
name of a project with the path
mylibrary. If this is
not what you want to use for
artifactId, then you need to change your project
There are two options for renaming your project:
- Rename the folder of the project. This changes the project name, or the Gradle path of the project, so all dependencies on that project need to be updated. While this might create more reorganization work initially, we recommend keeping the project name and folder the same because it reduces confusion in the long run.
- Rename the project in Gradle without renaming the folder of the project. This avoids the impact on source versioning, but it splits the project location and name.
To rename the project in Gradle, insert the following code in the
include ':path:to:mylibrary' project(':path:to:mylibrary').name = 'my-library'
include(":path:to:mylibrary") project(":path:to:mylibrary").name = "my-library"
This code assigns the new path of the project to
groupId defaults to the build name (which is generally the name of
the root folder), and the value version defaults to unspecified. To change the
values of group ID or version, set the
respectively, in your project-level
group = 'com.my-company' version = '1.0'
group = "com.my-company" version = "1.0"