首页 > 解决方案 > 如何配置 Maven 离线工作?完整的解决方案

问题描述

我需要配置 maven 以将依赖项下载到我的项目中的目录,以便我可以将我的项目复制到另一台没有 Internet 访问权限的 PC。我找到了 -o 选项和“依赖项:复制依赖项”插件,但没有人解释以后如何使用这些依赖项。下载依赖项然后在没有 Internet 连接的 PC 上使用它的方法是什么?

标签: mavenmaven-plugin

解决方案


Maven caches downloaded dependencies (and plugins -- just having the project's dependencies won't necessarily be enough depending on the pom structure) in ~/.m2/repository. If you build your project, then clone the ~/.m2/repository directory as well as your project to another machine, you should be able to build in offline mode with all dependencies available to use.


推荐阅读