Hi, Barrie,
Ask a stupid question about enforcer plugin.
I added enforcer plugin into project pom like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<DependencyConvergence/>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
But it always complain missing parameter: rules.
Below is debug log.
Any mistakes in above code?
~~~
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-enforcer-plugin:1.1.1:en
force from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-enforce
r-plugin:1.1.1, parent: sun.misc.Launcher$AppClassLoader@233e233e]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-enforcer-plugin:1.1.1:e
nforce' with basic configurator -->
[DEBUG] (s) fail = true
[DEBUG] (s) failFast = false
[DEBUG] (f) ignoreCache = false
[DEBUG] (s) project = MavenProject: com.ebay.raptor.buyerexp.framework:CoreApp
Framework:4.1.1-W41-SNAPSHOT @ C:\gitrepo\search_raptor\CoreAppFramework\pom.xml
[DEBUG] (s) session = org.apache.maven.execution.MavenSession@3d153d15
[DEBUG] (s) skip = false
[DEBUG] -- end configuration --
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.050s
[INFO] Finished at: Thu Oct 11 15:49:28 CST 2012
[INFO] Final Memory: 17M/45M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.
1.1:enforce (default-cli) on project CoreAppFramework: The parameters 'rules' fo
r goal org.apache.maven.plugins:maven-enforcer-plugin:1.1.1:enforce are missing
or invalid -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-enforcer-plugin:1.1.1:enforce (default-cli) on pro
ject CoreAppFramework: The parameters 'rules' for goal org.apache.maven.plugins:
maven-enforcer-plugin:1.1.1:enforce are missing or invalid
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:221)
Regards
Simon
-----Original Message-----
From: Wang, Simon [mailto:[email protected]]
Sent: 2012年10月11日 13:41
To: Maven Users List
Subject: RE: How to optimize maven dependencies to get better performance?
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:[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]