【问题标题】:Can eclipse m2e share the maven cache between workspaces?eclipse m2e 可以在工作空间之间共享 maven 缓存吗?
【发布时间】:2018-02-20 15:55:01
【问题描述】:

我的每个 Eclipse 工作区在 org.eclipse.m2e.core 插件目录中都包含一个 2.5GB 的缓存。有什么方法可以跨工作区共享吗?

(我有大约 30 个工作区,出于需要)

【问题讨论】:

  • 对我来说,org.eclipse.m2e.core800 KB 附近。可以分享一下settings.xml吗?
  • 我的本地仓库设置?
  • 是的,尤其是标签<localRepository>
  • 别以为我有那个标签。 Maven 使用默认位置 ~/.m2/repository/

标签: eclipse maven m2eclipse m2e


【解决方案1】:

关于https://maven.apache.org/settings.html,我提供了<localRepository>的专用目录,如下例所示

${user.home}/.m2/settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 
                              http://maven.apache.org/xsd/settings-1.0.0.xsd" 
          xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <localRepository>path/to/repository</localRepository>
<settings>

注意:我使用 Eclipse for Windows 的菜单可能与你的不同。

Eclipse m2e 配置如下:-

  1. 创建新的干净工作区。
  2. 转到Windows --> Preferences,系统将显示Preferences对话框。
  3. Preferences 对话框中,选择Maven --> User Settings
  4. 在右侧面板
    • User Settings文本框设置为${user.home}/.m2/settings.xml
    • 按下名为Update Settings的按钮
    • 名为Local Repository (From merged user and global settings) 的文本框应显示路径path/to/repository 与标记&lt;localRepository&gt; 中的值相同。
  5. 创建新的 maven 项目
  6. 监控org.eclipse.m2e.core,大小应该减小了。

【讨论】:

  • 这只是改变了本地存储库的路径。它不会影响 Eclipse Maven 缓存。存储库缓存仍然在每个工作区中重复。
猜你喜欢
  • 2015-07-13
  • 2013-09-24
  • 1970-01-01
  • 2019-03-07
  • 2017-08-23
  • 1970-01-01
  • 1970-01-01
  • 2022-08-06
  • 2012-10-22
相关资源
最近更新 更多