简体   繁体   English

Maven和M2Eclipse共存

[英]Maven and M2Eclipse Co-existing

Firstly I've installed maven 3 to /path/to/maven and configured /path/to/maven/conf/setting.xml below, 首先,我已经将maven 3安装到/ path / to / maven并在下面配置了/path/to/maven/conf/setting.xml,

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

then installed m2eclipse on Eclipse 3.7.2 for Java EE and configured it below, 然后在Eclipse 3.7.2 for Java EE上安装了m2eclipse并在下面进行了配置,

preferences->maven->
 installation->"/path/to/maven"
 userSettings->"/path/to/maven/conf/setting.xml"
 localRepository->"/path/to/repository"

On completion of building the index by m2eclipse , a duplicate .cache directory has been generated under both /path/to/repository and /path/to/home/.m2/repository below, 完成m2eclipse构建索引后,在/ path / to / repository和/path/to/home/.m2/repository下面生成了一个重复的.cache目录,

.cache/
└── [4.0K]  m2e
    └── [4.0K]  1.2.0
        └── ....
            ├── [ 64M]  nexus-maven-repository-index.gz
            └── [1.1K]  nexus-maven-repository-index.properties
  • What could have caused the index duplication? 什么可能导致索引重复? Is it just normal? 这是正常的吗?

  • What would be the side effects on the index above, if I use both mvn CLI and m2eclispe alternately (not in parallel)? 如果我交替使用mvn CLIm2eclispe (不是并行),那么对上面的索引有什么副作用?

It is not common to have two repositories. 拥有两个存储库并不常见。 Both m2e and cli should point to same repo. m2e和cli都应指向相同的回购。 Verify your eclipse settings for maven. 验证maven的eclipse设置。

Sachin is right - you're probably misconfigured. 萨钦是对的 - 你可能错误配置了。 That said, I would consider dropping a symlink in my home directory instead of configuring a different path. 也就是说,我会考虑在我的主目录中删除符号链接而不是配置不同的路径。 That way there is no need to ensure that any tool is configured correctly, as the default location just points somewhere else. 这样就不需要确保正确配置任何工具,因为默认位置只是指向其他位置。

Having duplicate repositories could be caused by bad formed settings.xml. 拥有重复的存储库可能是由于形成错误的settings.xml引起的。 eg if it contains errors (like some unclosed tags), m2eclipse will ignore it and generate a new in-memory settings model, using the default values. 例如,如果它包含错误(如某些未关闭的标签),m2eclipse将忽略它并使用默认值生成新的内存设置模型。

In command line, check that mvn help:effective-settings executes properly. 在命令行中,检查mvn help:effective-settings是否正确执行。

The cached index is only used by m2e, so it can't be corrupted when using both m2e and maven CLI. 缓存的索引仅由m2e使用,因此在使用m2e和maven CLI时不会损坏它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM