views:

219

answers:

1

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.

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.

Steps to reproduce:

  1. In one project, check out / configure a module that depends on a Maven snapshot of some other module.
  2. In a separate project, make a change to that other module, e.g. adding a method, and deploy it to the Maven repository.
  3. In the first project, update the snapshot.
  4. In the first project, write some code that calls the new method.

Expected:

  • No trouble calling the new method.

Actual:

  • 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

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.

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" 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.)

A: 

Sorry I don't really have a true answer but I very much suspect that your problem comes from the updatePolicy being set to never. Could you clarify why you believe that to be necessary? I would not at all be surprised if the IDEA setting does not override this correctly. You could use the maven help plugin with the effective pom to see if it comes out right for IDEA.

Oh and your justification in () at the end sounds very dubious. I have not had these problems in Eclipse. Are you using the M2Eclipse plugin? I think "never" is NOT correct for developers. In fact I believe it should be always for developers .. which is the default behaviour.

Manfred Moser
Nobody had the problem here till they upgraded to the 2010-02-09 version of M2Eclipse, but IAM exhibited a similar problem. Maybe it's also a factor of the size of our codebase.Why do you think "always" is correct? It seems to me as though that means updates to any code you're not currently working on get pushed to you whether you want them or not, rather than pulled when you want them. That seems like bad news if that code's also under active (potentially destabilizing) development. But maybe I misunderstand the setting?
David Moles

related questions