2010-03-09 227 views
8

我們希望根據客戶的選擇來捆綁來自(Alfresco或Jackrabbit或...)的庫依賴關係。依賴關係的數量實際上取決於所選供應商。我們如何在maven級別提供鉤子,以便最終產品僅包含依客戶選擇的相關罐子。maven條件依賴關係

回答

18

你可以通過將所需的依賴到供應商特定profiles在你的POM中實現這一點:

<profiles> 
    <profile> 
     <id>Alfresco</id> 
     <dependencies> 
      ... 
     </dependencies> 
    </profile> 
    <profile> 
     <id>Jackrabbit</id> 
     <dependencies> 
      ... 
     </dependencies> 
    </profile> 
</profiles> 

然後你就可以激活所需的輪廓爲你打造這樣的:

mvn -PJackrabbit install