我有一個多模塊project其中我試圖設置許可證插件來管理所有許可證。這裏是項目設置:帶許可證插件的Maven多模塊項目
─── transfuse-project
├── examples
│ ├── helloAndroid
│ │ ├── pom.xml
│ │ ├── ...
│ ├── integrationTest
│ │ ├── pom.xml
│ │ ├── ...
│ ├── pom.xml
│ └── ...
├── transfuse
│ ├── pom.xml
│ ├── ...
├── transfuse-api
│ ├── pom.xml
│ ├── ...
├── NOTICE
└── pom.xml
每個pom.xml繼承自transfuse-project pom.xml。在pom.xml中我已經建立了許可證插件,該通知適用於相關文件的項目:如果我直接建在根(輸血項目)的
<plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<version>1.9.0</version>
<configuration>
<header>NOTICE</header>
<includes>
<include>**/*.java</include>
<include>**/*.xml</include>
</includes>
<excludes>
<exclude>**/.*/**</exclude>
<exclude>target/**</exclude>
<exclude>**/AndroidManifest.xml</exclude>
</excludes>
<properties>
<year>2013</year>
<name>John Ericksen</name>
</properties>
<useDefaultExcludes>true</useDefaultExcludes>
<strictCheck>true</strictCheck>
</configuration>
<executions>
<execution>
<id>check-headers</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
這種配置工作。直接構建integrationTest示例或api時會出現問題。 Maven的找不到我的項目的根目錄中提供的通知文件:
[ERROR] Failed to execute goal com.mycila.maven-license-plugin:maven-license-plugin:1.9.0:check (check-headers) on project transfuse-api: Some files do not have the expected license header -> [Help 1]
更糟糕的是,它發現另一個依賴的通知文件。如果我在子模塊中運行mvn license:format
,它會將所有模塊的標題替換爲依賴的通知文件。
我相信我可以在每個子模塊中添加一個NOTICE文件來解決這個問題,併爲每個子模塊配置自己的許可證插件,但是如果可能的話,我想避免這種重複。是否有一些配置或設置可用於我的項目設置?
啊,我想這一點。從根部開始工作,但構建任何子模塊都失敗。 –
編輯我的答案......它會工作,但它是額外的樣板 – asgoth
賓果,第二個選項工作。謝謝您的幫助。 –