On 11/10/2012 1:40 AM, Wang, Simon wrote: > Hi, Barrie, > That's really helpful! > > Even I have local cache, it also takes about 2 mins to resolve > dependencies. What is it doing during this time. Run maven with a detailed log to see each step.
You might want to break your project up into modules that are smaller and have fewer dependencies in each one. > Also it seems maven still will talk with remote maven server even I have > local cache. It will talk to your Nexus and you need to make sure that your POMs or settings.xml do not refer to any other Maven Repo besides your Nexus. > Yes, maybe it's caused by unspecified version numbers for dependencies. > Specify your versions on all dependencies > I'll try maven-enforcer-plugin. Not sure how this will help with performance. > > We're using nexus now, haven't tried MRM, I'll host it and compare it to > nexus. Nexus is an MRM. > > 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? The Eclipse IDE will do this with the m2 Eclipse plug-in. We use STS which is Eclipse fully loaded with everything that you need to use Maven. This is not likely going to cause a big performance hit. > Regards > Simon > > -----Original Message----- > From: Barrie Treloar [mailto:[email protected]] > 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 <[email protected]> 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: [email protected] > For additional commands, e-mail: [email protected] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] -- Ron Wheeler President Artifact Software Inc email: [email protected] skype: ronaldmwheeler phone: 866-970-2435, ext 102 --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
