Artifactory & Gradle:运行 许可证检查

Artifactory & Gradle: Running license checks

我们使用 Gradle 构建 Java 个项目,并将生成的工件推送到 Artifactory。

我们正在使用 Gradle Artifactory 插件,这意味着我们在 Artifactory 界面中看到了构建,我们还看到了许可证选项卡,其中包含有关构建中使用的许可证的信息。

但是,我无法解决仅使用 Gradle 插件就可以 运行 license checks 的问题。是否有设置让我提供电子邮件地址以接收许可证警报?还是我需要使用 CI 集成之一才能获得该功能?

Artifactory 包含一个 Mail Server Configuration 部分:

Artifactory supports sending mail to notify administrators and other users for significant events that happen in your system.

Some examples are:

  • Watch notifications
  • Alerts for backup warnings and errors
  • License violation notifications

但那是通过 CI 插件使用的,而不仅仅是 Gradle Artifactory Plugin (source code): see "Using Build Licenses"

You can also set a list of recipients to be notified about license violations as soon as they occur.
This way whenever a dependency with an unknown or unapproved license is added to the build recipients receive an immediate email notification and can tend to any potential license violation.

Sending license violation notifications is performed through Artifactory and requires a valid mail server to be configured.

检查 Build Info json format(Artifactory 为 CI 服务器和构建工具开放的集成层。构建信息以 json 格式发送到 Artifactory。)

确实包括:

"licenseControl" : {    // Artifactory License Control information
    "runChecks" : true, // Artifactory will run automatic license scanning after the build is complete (true/false)
    "includePublishedArtifacts" : true, // Should Artifactory run license checks on the build artifacts, in addition to the build dependecies (true/false) 
    "autoDiscover" : true, // Should Artifactory auto discover licenses (true/false)
    "scopesList" : "", // A space-separated list of dependency scopes/configurations to run license violation checks on. If left empty all dependencies from all scopes will be checked.
    "licenseViolationsRecipientsList" : "" // Emails of recipients that should be notified of license violations in the build info (space-separated list)
  },