There is still no easy way to do this. However, there is an open merge request that would add this feature.
Anyway, I solved it with a workaround. First, create an empty library and publish it to your local maven(or some other maven repo), and then add the library as a dependency.
You can publish the library to the local maven repo using this plugin.
The gradle file of the library would look like this:
publishing {
publications {
release(MavenPublication) {
groupId = "com.stephan"
artifactId = "mylib"
version = "1.0.0"
pom {
name = 'The name I want to show in the list'
licenses {
license {
name = 'The license'
url = 'https://url.to.license'
}
}
}
}
}
}
And the command to publish to the local maven repo: ./gradlew :nameoflibmodule:publishToMavenLocal
In the app project this can be easily added as a dependency with the usual implementation 'com.stephan:mylib:1.0.0'
(also add mavenLocal()
to the repositories in the build file)
The library can be empty, the only important part is that there is a pom file containing a <licenses>
element. This can be verified by looking into the local maven repo at $USER_HOME/.m2/repositories/
For my example this would be $USER_HOME/.m2/repository/com/stephan/mylib/1.0.0/mylib-1.0.0.pom