Maven插件处理许可证?

时间:2012-09-29 11:31:41

标签: maven licensing

由于Maven pom可以包含许可证信息,您是否有某种方式可以告诉您的构建“Apache v2”许可证是正常的,但是例如GPL并不构建Maven,如果需要依赖项,则会返回错误禁止许可证并最终要求您接受未知的许可证?

我知道有一些插件可以创建一个项目中所有已使用许可证的报告,但我找不到一个实际上允许你定义什么是好的,什么不是,并且如果它没有要求确认的单个插件不知道。

4 个答案:

答案 0 :(得分:4)

Mojohaus(前Codehaus)有相当灵活和成熟的license plugin应该可以胜任。

答案 1 :(得分:0)

您是否正在寻找有关如何配置maven-license-plugin的信息?查看this link

以下是一个使用示例:

<build>
    <plugins>
        <plugin>
            <groupId>com.mycila.maven-license-plugin</groupId>
            <artifactId>maven-license-plugin</artifactId>
            <configuration>
                <basedir>${basedir}</basedir>
                <header>${basedir}/src/etc/header.txt</header>
                <validHeaders>
                    <validHeader>/otherSupportedHeader.txt</validHeader>
                    <validHeader>http://www.company.com/yetAnotherSupportedHeader.txt</validHeader>
                </validHeaders>
                <quiet>false</quiet>
                <failIfMissing>true</failIfMissing>
                <aggregate>false</aggregate>
                <includes>
                    <include>src/**</include>
                    <include>**/test/**</include>
                </includes>
                <excludes>
                    <exclude>target/**</exclude>
                    <exclude>.clover/**</exclude>
                </excludes>
                <useDefaultExcludes>true</useDefaultExcludes>
                <mapping>
                    <jwc>XML_STYLE</jwc>
                    <application>XML_STYLE</application>
                    <myFileExtension>JAVADOC_STYLE</myFileExtension>
                </mapping>
                <useDefaultMapping>true</useDefaultMapping>
                <properties>
                    <year>${project.inceptionYear}</year>
                    <email>my@email.com</email>
                </properties>
                <encoding>UTF-8</encoding>
                <headerDefinitions>
                    <headerDefinition>def1.xml</headerDefinition>
                    <headerDefinition>def2.xml</headerDefinition>
                </headerDefinitions>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>check</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

答案 2 :(得分:0)

在这种情况下,我假设您正在讨论依赖项的许可证。 为此,您可以查看准确检查此类内容的Maven License Verifier Plugin。如果你看一下examples section,那就最好了。

答案 3 :(得分:0)

认为我找到了我正在寻找的工具: http://www.sonatype.com/clm/overview 但解决方案不仅包括maven插件,还提供我正在寻找的服务甚至更多。

相关问题