如何为 Android aar 库的 Google OSS 许可证插件提供许可证信息?

How to make license information available to Google OSS license plugin for an Android aar library?

我正在使用 OSS license plugin (note: I have to use version 0.9.5 because of a bug)

据我所知,"official" 不支持在 Gradle 中输入许可证信息(尽管这可能会包含在更高版本的 Gradle metadata 中规范),但通过使用 pom 文件部署 AAR 工件,可以声明许可证。

根据官方文档,这应该足够了:

How licenses are determined

The Gradle plugin scans the POM dependencies of the project at compile time. When a Maven POM exists for a direct dependency of the app, the plugin processes the element and embeds the link and title of each license in an Android asset in the final app APK.

Source: https://developers.google.com/android/guides/opensource#how_licenses_are_determined

我已经为我的 aar 库这样做了。这是部署在 Nexus 存储库中的生成的 pom.xml 文件的片段:

<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>my-artifact</artifactId>
<version>1.0.0</version>
<packaging>aar</packaging>
<licenses>
   <license>
      <name>Proprietary license</name>
      <url>https://someurl</url>
   </license>
</licenses>

不幸的是,OssLicensesMenuActivity 仍然不会列出我的依赖项。 我的声明如下所示:

api('com.mycompany:my-artifact@aar') {
    transitive = true
}

我想该插件适用于开源许可证,但我看不出这在技术上有什么关系。

问题: 我如何打包一个具有指定许可的 Android 库,该许可将显示在 OssLicensesMenuActivity 依赖于该库的应用程序中?

我能够完成这项工作。诀窍是通过 Maven2 存储库使依赖项可用。如果 pom.xml 文件带有许可证标签,那么这将显示在 OssLicensesMenuActivity 中。

据我所知,仍然没有指定许可证的“本地”Gradle方式。