I’ve tried to search for a solution for this, but have had no joy: In Intellij IDEA I’ve set up a set of modules so that I have the following:
- My Web Project (all module dependencies set to ‘Runtime’)
- My Web Project Dependency #1 (+ artifact that copies JAR to MWP’s /WEB-INF/lib)
- My Web Project Dependency #2 (+ artifact that copies JAR to MWP’s /WEB-INF/lib)
Dependency#1 has a class org.acme.foo, but so does MWP and the definition differs (oh joy). It builds ok – all code in MWP correctly builds against the classes in MWP instead of Dependency#1.
But…in its editor, Intellij is giving me the red squiggle because it’s preferring to reference the class in Dependency#1 with its incompatible definition.
Ignoring the fact that there really shouldn’t be this class/package clash, can anyone help me push Intellij into looking at the class in the local module, and not at the class in the dependency?
EDIT: I’m using the latest Intellij 11.
EDIT: for anyone finding this question, these troubles went away in Intellij 12+
I was facing the same issue in IntelliJ 11 (Mac OS X version).
I manually edited my project’s .iml file and re-arranged the dependencies in the right order: I put the orderEntry element containing the right version of the .jar file on top.
Hope this helps.