Maven Build Failure - failure to find plugins
I have created a project using the m2 eclipse tool and selected the web application archetype now if I try to package this empty application I get a build failure saying
[ERROR] Plugin org.apache.maven.plugins:maven-war-plugin:2.1 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-war-plugin:jar:2.1 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update in
terval of central has elapsed or updates are forced -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-war-plugin:2.1 or one of its dependencies could not be resolv
ed: Failure to find org.apache.maven.plugins:maven-war-plugin:jar:2.1 in http://repo1.maven.org/maven2 was cached in the local repository, resolution
will not be reattempted until the update interval of central has elapsed or updates are forced
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:96)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:136)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:251)
at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:197)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExections(DefaultLifecycleExecutionPlanCalculator.java
:134)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.
java:116)
at org.apache.maven.lifecycle.internal.BuilderCommon.resolveBuildPlan(BuilderCommon.java:92)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:314)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:151)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:445)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:168)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Failure to find org.apache.maven.plugins:maven-war-plugin:jar:2.1 in http://rep
o1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates
are forced
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:488)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:190)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:250)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:92)
开发者_Go百科 ... 23 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Failure to find org.apache.maven.plugins:maven-war-plugin:jar:2.1 in http://repo1.m
aven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are
forced
at org.sonatype.aether.impl.internal.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:191)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:384)
... 26 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Now I have tried updating the repository ect but I am having no luck.
Upon suggestion I have tried to update the plugin registry but there is no such file pugin-registry.xml on my file system.
Also it builds fine within eclipse but fails from command , so I'm guessing they are both using different versions. How to fix this?
Try using the -cpu
flag. Output from mvn -help
:
usage: mvn [options] [<goal(s)>] [<phase(s)>]
Options:
-cpu,--check-plugin-updates Force upToDate check for any
relevant registered plugins
You are missing a plugin required for the Maven build to function. Check and tweak the values in the Plugin Registry such that an update is forced. You can also use command line parameters to force the download of the plugin.
I followed below steps and it worked for me. Check if it is useful for you.
project-->properties-->Maven-->User settings
change user settings to point out to correct settings.xml and to your repository folder should exist in your system.
This is resolved when I moved back to maven v 3.0.4.
精彩评论