Lin, there is no magic involved. Maven produces a Class Path at runtime made up from the declared dependencies in the effective POM (i. e. your explicit POM and any explicit and implicit parent POMs, and any implied POMs due to dependencies). Eclipse uses that Class Path as part of the one it constructs on its own, you even can tell Eclipse the rank where to put the Maven Classpath relatively to siblings. Eclipse just checks all Classes in the Classpath for name equality, picks the sole match automatically, or provides a list of possible matches for the user to pick from. That's all. Pretty simple and straightforward, and everything but magic.
Regards -Markus -----Ursprüngliche Nachricht----- Von: Lin Ma [mailto:lin...@gmail.com] Gesendet: Montag, 23. März 2015 06:24 An: Maven Users List Betreff: java import package and maven dependencies Hi Maven masters, It is magic when we add dependencies in Maven pom.xml, IDE like IntelliJ could resolve it for java import package statement at the beginning of each .java file. Want to learn a bit more how Maven or IDE will use dependencies in Maven pom.xml file to resolve import package in .java file automatically? Does it on the backend download and put the jar in dependencies in class path, and treat it the same as manually add an external jar file? Any good articles are appreciated. thanks in advance, Lin