在IDEA中,是否有一种方法可以强制对Maven快照重新编制索引? [英] In IDEA, is there a way to force reindexing of Maven snapshots?

查看:740
本文介绍了在IDEA中,是否有一种方法可以强制对Maven快照重新编制索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个大型的多模块Maven项目.通常的工作方式是检查一些您感兴趣的模块,对于它们依赖的其他模块,请使用Maven提供的快照JAR.

We have a large multi-module Maven project. The usual working style is to check out a few modules you're interested in, and for the other modules they depend on, use snapshot JARs provided by Maven.

这似乎主要是有效的;当我们需要更新的快照时,只需从"Maven项目"选项卡中强制重新导入即可.但是,重新导入的快照似乎永远不会重新索引.

This mostly seems to work; when we need updated snapshots, we just force a reimport from the "Maven Projects" tab. However, the reimported snapshots never seem to get reindexed.

复制步骤:

  1. 在一个项目中,签出/配置一个依赖于其他模块的Maven快照的模块.
  2. 在一个单独的项目中,对该其他模块进行更改,例如添加方法,并将其部署到Maven存储库.
  3. 在第一个项目中,更新快照.
  4. 在第一个项目中,编写一些调用新方法的代码.

预期:

  • 调用新方法没问题.

实际:

  • 方法调用被重新标记为无法解析方法"错误.然而:
    • 代码确实可以编译(通过生成"或上下文菜单)
    • 代码确实在运行,包括调用新方法的代码
    • Method call is redlined with "Cannot resolve method" error. However:
      • Code does compile (via the Build or context menu)
      • Code does run, including code that calls the new method

      有没有解决的办法?摆脱红线,完成自动完成等工作,并且通常能够继续按您期望的方式使用IDEA,将是很好的选择.

      Is there some way around this? It would be nice to get rid of the redline, have autocomplete etc. work, and in general be able to continue to use IDEA the way you're supposed to.

      可能是相关的:我们混合了Eclipse和IDEA开发人员,并且为了解决一些Eclipse/Maven集成错误,我们在pom.xml文件中将快照updatePolicy设置为从不".但是,除非我误解了设置的作用,否则我希望IDEA设置(快照更新策略:始终更新)会覆盖此设置.

      Possibly relevant: We have a mix of Eclipse and IDEA developers, and in order to work around some Eclipse/Maven integration bugs, we've set the snapshot updatePolicy to "never" in our pom.xml files. However, I would expect the IDEA setting (Snapshot update policy: Always update) to override this, unless I misunderstand what the setting does.

      ("Never"似乎违反直觉,但我认为对开发人员来说是正确的:手动更新依赖项,就像从VCS手动更新源代码一样.对于实际构建,我们还是让Hudson覆盖了POM设置.更重要的,将其设置为从不"将阻止Eclipse避免不必要的不​​必要的总重新编译.)

      ("Never" might seem counterintuitive, but I think it's correct for developers: update dependencies manually, just as you update source code from the VCS manually. For real builds, we have Hudson override the POM settings anyway. And more importantly, setting it to "never" stops Eclipse from rabid unnecessary total recompiles.)

      推荐答案

      有时单击同步"(窗口左上方保存"按钮附近的黄色箭头)可以为我解决此问题-我认为这会迫使IDEA查找文件系统上任何更新的JAR文件.可能是文件系统通知中的错误...

      Sometimes clicking 'synchronize' (the yellow arrows near the save button at the top left of the window) fixes this for me - I think it forces IDEA to look for any updated JAR files on the filesystem. Could be a bug in filesystem notification...

      (在这种情况下,您的maven项目指向所有正确的JAR,但是IDEA尚未重新索引新的JAR文件.因此,问题在于文件系统索引,而不是maven项目设置)

      (In this case your maven project is pointing to all the right JARs, but IDEA hasn't re-indexed the new JAR file. So it's the filesystem index that's the problem, not the maven project setup)

      这篇关于在IDEA中,是否有一种方法可以强制对Maven快照重新编制索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆