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]

Reply via email to