Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > why maven auto import commons-lang

Reply
Thread Tools

why maven auto import commons-lang

 
 
mcheung63@gmail.com
Guest
Posts: n/a
 
      06-11-2013
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 ((E-Mail Removed))
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      06-11-2013
On Monday, June 10, 2013 7:21:56 PM UTC-7, (E-Mail Removed) 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
 
Reply With Quote
 
 
 
 
Fredrik Jonson
Guest
Posts: n/a
 
      07-03-2013
In <(E-Mail Removed)> 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
 
Reply With Quote
 
Nicole Rivers
Guest
Posts: n/a
 
      10-03-2013
hi there! we have a related article about Maven. You may want to check it out, this might help http://www.ideyatech.com/2012/07/setting-up-maven/

Thanks!
 
Reply With Quote
 
Jukka Lahtinen
Guest
Posts: n/a
 
      10-03-2013
Nicole Rivers <(E-Mail Removed)> 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
 
Reply With Quote
 
Joerg Meier
Guest
Posts: n/a
 
      10-03-2013
On Thu, 03 Oct 2013 17:23:56 +0300, Jukka Lahtinen wrote:

> Nicole Rivers <(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN] maven-jstools-plugin v0.2: JS reporting and dependency tools for Maven projects manos Javascript 0 10-06-2007 05:11 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
tomcat-maven-plugin problem - mvn is looking for org.apache.maven.plugins:maven-tomcat-plugin Marcin Cenkier Java 1 04-12-2006 08:00 PM
to use import java.lang.* or import java.lang.Math or none at all? JPractitioner Java 13 02-24-2006 08:48 PM
java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory greg.knaddison@gmail.com Python 1 06-22-2004 10:58 PM



Advertisments