代码之家  ›  专栏  ›  技术社区  ›  hce

自动获取商业项目中所有依赖开源工件的许可证信息

  •  0
  • hce  · 技术社区  · 7 年前

    在我们公司,有许多JEE后端应用程序部署到jfrog artifactory。这些项目中的每一个都包含对其他maven存储库源的一些依赖性,而这些源又有许多其他依赖性。所以当我使用其中一个依赖项时,比如

    <project>
      ...
      <dependencies>
        <dependency>
          <groupId>sample.ProjectA</groupId>
          <artifactId>Project-A</artifactId>
          <version>1.0</version>
          <scope>provided</scope>          
        </dependency>
      </dependencies>
    </project>
    

    Sample.ProjectA.Project-A可能有一些商业依赖关系。 我看到maven使用licenses字段来放置许可证信息

      <licenses>
        <license>
          <name>Apache License, Version 2.0</name>
          <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
          <distribution>repo</distribution>
        </license>
      </licenses>
    

    我还找到了一种通过reports info插件获得maven许可证的方法 maven-project-info-reports-plugin

    现在最好告诉maven警告是否有商业许可证。有可能这样做吗?

    1 回复  |  直到 7 年前
        1
  •  3
  •   Stephen C    7 年前

    有几个Maven插件可以验证项目依赖项使用的许可证:

    • “ayoy许可证验证程序maven插件”( reference
    • “khmarbaise/Maven许可证验证插件”( reference )

    • 一些Maven工件不在POM文件中声明许可证。
    • 这些插件依赖于 <license> 在依赖项的POM中使用 众所周知的 许可证的名称或URL。不幸的是,这些并没有标准化(如示例“licenses.xml”文件所示)。这取决于你想出一个解决办法。
    • 这些插件并不试图将许可证分类为“商业”或“非商业”。你必须自己解决这个问题。