2011-04-21 53 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