2011-04-21 52 views
1

我有一個非常大的資源(超過100 MB)。我寧願不檢查到SVN中,因爲那些不依賴於這個項目的用戶仍然需要下載100 MB。我正在使用maven構建系統/依賴項管理。我如何使用maven處理這些資源?用maven處理大型資源依賴關係

回答

1

如果您的ressource是一個罐子或類似的東西,你可以把它添加到你的資料庫:

mvn install:install-file 
    -Dfile=<path-to-file> 
    -DgroupId=<group-id> 
    -DartifactId=<artifact-id> 
    -Dversion=<version> 
    -Dpackaging=<packaging> 
    -DgeneratePom=true 

Where: <path-to-file> the path to the file to load 
     <group-id>  the group that the file should be registered under 
     <artifact-id> the artifact name for the file 
     <version>  the version of the file 
     <packaging>  the packaging of the file e.g. jar 

如果不是這樣,你必須要找到一個其他的方式在數據庫中,例如,或在一個共享目錄,你沒有把它放在SVN中。

+0

我的資源不是罐子。我可以使它成爲一個jar依賴項。我嘗試使用遠程資源插件,它從svn中獲取jar。但是,現在每次部署依賴於資源的項目時,它都會構建一個100 MB的jar。遠程資源相對於正常依賴的優勢是什麼? – schmmd 2011-05-03 18:34:59

+0

只有當您想將遠程資源合併到您自己的jar中時,您才必須使用remote-resources插件。正常的依賴關係只是一個鏈接到現有的jar。如果您不需要更改現有的jar(例如添加許可證文件),則不要使用遠程資源。 – Tristan 2011-05-05 07:05:26

+0

爲每個依賴項(通常只是'src/main/resources'中的文件)製作一個簡單的maven項目效果很好。 – schmmd 2013-08-06 00:47:06