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:
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 had this problem and was using Vladimir's answer which worked (hence my upvote) but unfortunately I found that I had to keep re-editing the .iml file as it was constantly being rewritten. After some digging I found how to change this permanently:
Navigate to File -> Project Structure -> Modules -> -> Dependencies tab
IntelliJ will add the dependencies to the classpath in the order they are listed there. To move them, simply highlight the dependency you want to move and use the up and down arrows on the toolbar at the bottom.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With