why maven auto import commons-lang

M

mcheung63

hi all
in my class, i have "import org.apache.commons.lang.ArrayUtils;". In pom.xml, i didn't import commons-lang, but i can "mvn compile" successfully. Why?
thanks
from Peter ([email protected])
 
L

Lew

in my class, i have "import org.apache.commons.lang.ArrayUtils;". In pom.xml, i didn't import commons-lang, but i can "mvn compile" successfully. Why?

Maven is usually pretty good about tracking transitive dependencies and fetching them. Some other POM probably called for it.

This works great until multiple POMs ask for different versions of the same library. Ouch!
 
F

Fredrik Jonson

In said:
Maven is usually pretty good about tracking transitive dependencies and
fetching them. Some other POM probably called for it.

If that is the case I recommend that you still declare it in your own pom
too, just to make it explicit for your future self and other developers that
work with the project.
This works great until multiple POMs ask for different versions of the
same library. Ouch!

Yes, you need to be mindful about which transitive dependencies your
declared dependencies pulls in. I make it a habit to regularily check my
dependencies with the command 'mvn dependency:tree'.

The few cases where version mismatch occurs it can normally be handled by
declaring exclusions on one of the dependencies. In my experience this
happens rarely and I cant remember the last time, if ever, where I was
unable to resolve it with exclusions.
 
J

Jukka Lahtinen

Nicole Rivers said:
hi there! we have a related article about Maven. You may want to check it

Who is "we" and why is there no referred posting even though yours
contains the References header and the subject begins with "Re:"?
 
J

Joerg Meier

Who is "we" and why is there no referred posting even though yours
contains the References header and the subject begins with "Re:"?

Because you are conversing with a spam bot that replies to decade old posts
with spam.

Liebe Gruesse,
Joerg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top