0

我有一个包含相当多依赖项的多模块构建。每个子项目都有自己的依赖关系报告,并且有一个项目(可传递地)依赖于所有其他项目。现在有许多依赖项缺少许可信息。我想在依赖报告中包含所有这些缺失的许可证。但我似乎无法让这个工作。有人有建议吗?

我目前正在尝试的是:

  • 在父项目中,我通过添加具有这些名称的子目录在 src/license 中定义了各种第三方许可证,例如“eula”、“potix_eula”、“bsd_pgsql”……
  • 在这些目录中,我有许可证的 header.txt 和 license.txt 文件
  • 在这个 src/license 目录中,我有一个 licenses.properties,其中包含诸如“potix_eula=potix_eula”之类的条目
  • 在这个 src/license 目录中,我还有一个 licenses.xml ,其中包含以下条目
<dependency>
  <groupId>org.postgresql</groupId>
  <artifactId>jdbc4</artifactId>
  <licenses><license><name>bsd_pgsql</name></license></licenses>
</dependency>
  • 在父项目的 pom 中,我配置了 license-maven-plugin:
<plugin>
  <groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>1.5</version>
<configuration>         
      <useMissingFile>true</useMissingFile>
      <licensesConfigFile>C:/eclipse-workspace-kepler/TheParentProject/src/license/licenses.xml</licensesConfigFile>
      <licenseName>zk_potix_eula</licenseName>
      <licenseName>bsd_pgsql</licenseName>
      <licenseResolver>file://${project.basedir}/src/license</licenseResolver>
      <licenseMerges>...</licenseMerges> 
    </configuration>
        <executions>
          <execution>
          <id>first</id>
          <goals>
            <goal>update-file-header</goal>
          </goals>
          <phase>process-sources</phase>
        </execution>
          <execution>
            <id>download-licenses</id>
            <phase>process-resources</phase>
            <goals>
              <goal>download-licenses</goal>
            </goals>
          </execution>
        <execution>
          <id>add-third-party</id>
          <phase>process-resources</phase>
          <goals>
            <goal>aggregate-add-third-party</goal>
          </goals>
        </execution>
      </executions>
     </plugin>
  • 我已经在所有项目中生成了 THIRD-PARTY.properties 并定义了这样的许可证:commons.apache.org--commons-configuration--1.7=apache_v2
  • 我还尝试将 src/license 目录从父目录复制到模块的所有 src 目录中。它仍然不起作用。
4

1 回答 1

1

我明白了,我忘了包含包含所有必需信息的第三方报告。

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>license-maven-plugin</artifactId>
    <version>1.5</version>
    <configuration>
      <useMissingFile>true</useMissingFile>
      <useRepositoryMissingFiles>true</useRepositoryMissingFiles>
        <licenseName>zk_potix_eula</licenseName>
        <licenseName>bsd_pgsql</licenseName>
        <licenseName>bsd_hamcrest</licenseName>
        <licenseName>bsd_dom4j</licenseName>
        <licenseResolver>file://${project.parent.basedir}/src/license</licenseResolver>
        <licenseMerges>
          <licenseMerge>Apache 2.0|The Apache Software License, Version 2.0|Apache License, Version 2.0|apache_v2</licenseMerge>
          <licenseMerge>CDDL 1.0|COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0|Common Development and Distribution License (CDDL) v1.0|cddl_v1</licenseMerge>
          <licenseMerge>GNU LGPL 2.1|GNU Lesser General Public License (LGPL), Version 2.1|GNU Lesser General Public License, version 2.1|lgpl_v2_1</licenseMerge>
          <licenseMerge>GNU LGPL 3|GNU LESSER GENERAL PUBLIC LICENSE, Version 3|GNU Lesser General Public Licence|GNU Lesser General Public License|GNU LESSER GENERAL PUBLIC LICENSE</licenseMerge>
          <licenseMerge>Dual license: CDDL 1.0 and GPL v2|Dual license consisting of the CDDL v1.0 and GPL v2|CDDL+GPLv2|CDDL+GPL|CDDL+GPL License</licenseMerge>
          <licenseMerge>Dual license: CDDL 1.1 and GPL v2|Dual license consisting of the CDDL v1.1 and GPL v2|CDDL1_1+GPLv2</licenseMerge>
          <licenseMerge>Dual License: CDDL 1.0 and GPL V2 with Classpath Exception|CDDL + GPLv2 with classpath exception</licenseMerge>
        </licenseMerges> 
    </configuration>
  </plugin>
于 2013-08-21T14:15:19.443 回答