2013-01-11 30 views
0

我有一個大型的多模塊項目。該項目中的許多模塊需要創建用於構建項目分發的輔助工件。我創建了一個共享程序集描述符,它工作正常。如何讓程序集插件在空集合上失敗?

我目前的問題是,某些模塊沒有任何由描述符拾取的內容,這會導致程序集插件因爲程序集爲空而失敗。

當程序集爲空時,有什麼方法可以防止程序集插件掉下來嗎?我看了單參數&找不到任何東西。我不想在每個模塊上手動啓用/禁用此程序集,我想在沒有任何內容的父級和子級模塊上配置程序集以跳過程序集上的創建而不是失敗。

回答

0

您可以將您的程序集插件配置移動到父級中的<pluginManagement>部分,然後僅在需要它的子模塊中指定程序集插件。

家長:

<pluginManagement> 
    <plugins> 
    <plugin> 
     <groupId>org.apache.maven.plugins</plugin> 
     <artifactId>maven-assembly-plugin</plugin> 
     <version>${your.version}</version> 
     <configuration> 
      <!-- whatever you have here now --> 
     </configuration> 
     <executions> 
      <!-- whatever you have here now --> 
     </executions> 
    </plugin> 
    </plugins> 
</pluginManagement> 

的孩子,需要創建裝配:

<build> 
    <plugins> 
    <!-- Pull in config from the parent --> 
    <plugin> 
     <groupId>org.apache.maven.plugins</plugin> 
     <artifactId>maven-assembly-plugin</plugin> 
    </plugin> 
    ..... 
    </plugins> 
    ..... 
</build> 
+0

謝謝,但正如我所說,這正是我**不**想做的事(即手動啓用) 。我想定義在父母的執行&有程序集插件沒有操作,而不是失敗是沒有什麼可以組裝在兒童。 – carej

相關問題