Hi, Barrie,
   That's really helpful!

   Even I have local cache, it also takes about 2 mins to resolve dependencies.
   Also it seems maven still will talk with remote maven server even I have 
local cache.
   Yes, maybe it's caused by unspecified version numbers for dependencies.
   
   I'll try maven-enforcer-plugin.

   We're using nexus now, haven't tried MRM, I'll host it and compare it to 
nexus.

   And I saw aether(major in dependency resolving) will take longer time to 
resolve conflict dependencies.
   Is it also a point that need to be improved?
   Do you know is there any maven plugin to identify conflict dependencies?

Regards
Simon

-----Original Message-----
From: Barrie Treloar [mailto:baerr...@gmail.com] 
Sent: 2012年10月11日 11:48
To: Maven Users List
Subject: Re: How to optimize maven dependencies to get better performance?

On Thu, Oct 11, 2012 at 1:46 PM, Wang, Simon <yunfeng.w...@ebay.com> wrote:
> Hi,
>    We're in trouble of terrible performance on resolve maven dependencies.
> I did some search about it. Basically below ways should be helpful:
>
> 1. optimize nexus server to improve response time.
> 2. optimize maven dependencies.
>   1) avoid duplicated dependencies
>   2) avoid dependency conflict cases
>   3)....
>
> Any others suggestions?

What specifically is your problem?

I can only guess at what you mean.
I'm assuming that when you run "mvn install" that maven is reaching out to 
check for new dependencies which can be time consuming, especially with an 
empty ~/.m2/repository local cache.
After the first install this shouldn't be a problem.

Firstly make sure that you do not define additional "repository" in either your 
settings.xml or pom.xml.
Every dependency will be checked against all repositories defined.
So just by defining one extra repository will double the time it takes to check 
dependencies.
There is no logic in Maven to blacklist/whitelist what artifacts are located 
where, this is one reason why you use a Repository Manager.
You can see that if you declare repositories in your pom.xml and this is 
published how it will affect everyone that includes your artifacts.
Please don't do that.

Secondly, make sure you lock down all version numbers of dependencies.
It is bad practice to not specify these as it makes your build non-reproducable.
This could also be a reason why it is slow as Maven will need to check 
periodically to see if new versions are available.
You can use maven enforcer
(http://maven.apache.org/plugins/maven-enforcer-plugin/) to ensure that you 
have no unversioned artifacts.

Thirdly, install a Maven Repository Manager (Nexus is one).
This will act as a local proxy and make downloading times much faster.
It also provides an aggregation point, so that there is only one repository to 
check each artifact for and the Repository Manager will hide checking the other 
repos MRMs also allow you to do whitelist/blacklist stuff to improve 
performance.
If you are in a corporate environment you really want an MRM installed.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to