Thanks Markus, Do you know on IntelliJ, how to see Maven update Classpath and settings in IntelliJ how Classpath by Maven is prioritized among other Jars/paths on Classpath?
regards, Lin On Mon, Mar 23, 2015 at 2:07 AM, Markus Karg <[email protected]> wrote: > With "at runtime" I mean "when Eclipse is performing the 'organize import' > functionality" or its various variants. > > -----Ursprüngliche Nachricht----- > Von: Lin Ma [mailto:[email protected]] > Gesendet: Montag, 23. März 2015 08:59 > An: Maven Users List > Betreff: Re: java import package and maven dependencies > > Thanks Markus, > > For "at runtime", I think you do not mean when running the Java > application, but when we add a new dependency in pom.xml, Maven will > download the dependency and add the JAR into Classpath which Eclipse will > recognize? -- so that the import package statements could be recognized and > resolved in IDE? > > regards, > Lin > > On Mon, Mar 23, 2015 at 12:29 AM, Markus Karg <[email protected]> wrote: > > > 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:[email protected]] > > 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 > > >
