why maven auto import commons-lang

Discussion in 'Java' started by mcheung63@gmail.com, Jun 11, 2013.

  1. Guest

    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 ()
    , Jun 11, 2013
    #1
    1. Advertising

  2. Lew Guest

    On Monday, June 10, 2013 7:21:56 PM UTC-7, wrote:
    > 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!

    --
    Lew
    Lew, Jun 11, 2013
    #2
    1. Advertising

  3. In <> Lew wrote:

    > 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.

    --
    Fredrik Jonson
    Fredrik Jonson, Jul 3, 2013
    #3
  4. Nicole Rivers, Oct 3, 2013
    #4
  5. Nicole Rivers <> writes:

    > 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:"?

    --
    Jukka Lahtinen
    Jukka Lahtinen, Oct 3, 2013
    #5
  6. Joerg Meier Guest

    On Thu, 03 Oct 2013 17:23:56 +0300, Jukka Lahtinen wrote:

    > Nicole Rivers <> writes:
    >> 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:"?


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

    Liebe Gruesse,
    Joerg

    --
    Ich lese meine Emails nicht, replies to Email bleiben also leider
    ungelesen.
    Joerg Meier, Oct 3, 2013
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JPractitioner
    Replies:
    13
    Views:
    20,143
    Roedy Green
    Feb 24, 2006
  2. Marcin Cenkier
    Replies:
    1
    Views:
    5,406
    Marcin Cenkier
    Apr 12, 2006
  3. Replies:
    1
    Views:
    2,136
    Irmen de Jong
    Jun 22, 2004
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,804
    Smokey Grindel
    Dec 2, 2006
  5. manos
    Replies:
    0
    Views:
    227
    manos
    Oct 6, 2007
Loading...

Share This Page