2012-09-29 30 views
4

由於Maven pom可以包含許可證信息,有沒有某種方式可以讓你的構建告訴你的構建「Apache v2」許可證是可以的,但GPL例如不是,當你構建Maven的時候會返回錯誤,如果需要的話依賴關係被禁止許可證,並最終要求你接受未知的許可證?Maven插件處理許可證?

我知道有一些插件可以創建項目中所有已使用許可證的報告,但我找不到一個實際允許您定義什麼是好的,什麼不是,並且要求確認的插件不知道。

+1

我投票結束這個題目,因爲它是關於授權或法律問題,而不是編程或軟件開發。 –

+0

恰恰相反...我正在談論的發展中,我想阻止在我的構建中使用禁止許可類型。我知道許可證是合法的東西,但控制我的依賴關係是一種構建方式。我看到它類似於「只有有效的osgi包的依賴」或類似的約束。 –

回答

0

在想我已經找到我一直在尋找的工具: http://www.sonatype.com/clm/overview 但是,溶液由不僅僅是一個Maven插件多,但它提供了我一直在尋找,甚至更多的服務。

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>[email protected]</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> 
4

Mojohaus(前代碼館)有非常靈活和成熟的license plugin應該做的工作。