maven build时报错

maven build时报错Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.319 s
[INFO] Finished at: 2017-02-24T10:05:13+08:00
[INFO] Final Memory: 16M/205M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project base-util: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved: Failure to find org.apache.maven.surefire:maven-surefire-common:jar:2.12.4 in http://192.168.16.91/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of user-releases has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project zhiyuan-base-util: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved: Failure to find org.apache.maven.surefire:maven-surefire-common:jar:2.12.4 in http://192.168.16.91/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of user-releases has elapsed or updates are forced
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved: Failure to find org.apache.maven.surefire:maven-surefire-common:jar:2.12.4 in http://192.168.16.91/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of user-releases has elapsed or updates are forced
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:104)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved: Failure to find org.apache.maven.surefire:maven-surefire-common:jar:2.12.4 in http://192.168.16.91/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of user-releases has elapsed or updates are forced
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:208)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.createPluginRealm(DefaultMavenPluginManager.java:359)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.setupPluginRealm(DefaultMavenPluginManager.java:327)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getPluginRealm(DefaultBuildPluginManager.java:230)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:100)
    ... 20 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find org.apache.maven.surefire:maven-surefire-common:jar:2.12.4 in http://192.168.16.91:8080/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of user-releases has elapsed or updates are forced
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:459)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:367)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:200)
    ... 24 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find org.apache.maven.surefire:maven-surefire-common:jar:2.12.4 in http://192.168.16.91/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of user-releases has elapsed or updates are forced
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:232)
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:206)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:599)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:518)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:436)
    ... 27 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

可能原因有很多个,  1. maven私服连不上了, 有一些jar包没有下载到本地, 或者是私服的路径配置错误

<distributionManagement>
        <repository>
            <id>user-releases</id>
            <name>Nexus Release Repository</name>
            <url>http://192.168.16.91/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>user-snapshots</id>
            <name>Nexus Snapshot Repository</name>
            <url>http://192.168.16.91/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

配置可以参考上面这段, url链接要在地址栏里面能打开才算正确

还有可能是一个jar包下载失败, jar包坏了, 可以删掉本地的repository, 执行maven->update project...重新下载jar到本地仓库

2. .classpath配置文件错误

  在项目上右键->properties->java build path->source->删掉里面的src/main/java和src/test/java配置, 然后点右侧的add folder重新添加

3. 测试类里面报错, 导致无法build

  可以删掉测试类, 重新尝试构建

4. 如果以上三个都无法解决这个问题, 那就删工作空间吧, 干掉workspace!!

原创声明,本文系作者授权云+社区发表,未经许可,不得转载。

如有侵权,请联系 yunjia_community@tencent.com 删除。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏SAP最佳业务实践

SAP S/4HANA最佳业务实践:Order-to-Cash订单到收款-4报价单处理

•The tile Manage Sales Quotationsis part of the business catalog Sales –Quotatio...

32880
来自专栏java达人

SpringMVC下Excel文件的上传下载

在实际应用中,经常会遇到上传Excel或者下载Excel的情况,比如导入数据、下载统计数据等等场景。针对这个问题,我写了个基于SpringMVC的简单上传下载示...

37690
来自专栏Java技术分享

maven build时报错Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test

maven build时报错Failed to execute goal org.apache.maven.plugins:maven-surefire-plu...

1.3K50
来自专栏潇涧技术专栏

Gradle Plugin for Android Development User Guide 2

Gradle Plugin for Android Development User Guide (2)

11610
来自专栏绿巨人专栏

git使用说明

30960
来自专栏杨建荣的学习笔记

10g升级至11g后数据库无法启动的问题解决

今天升级数据库碰到一个很郁闷的问题,把10g的数据库升级到11g以后,结果有一个改动,需要重启数据库,就敲了shutdown immediate,结果再star...

43260
来自专栏数据库新发现

VCS学习笔记

VERITAS Cluster Server(VCS) connects, or clusters, multiple, independent systems...

14020
来自专栏码匠的流水账

kafka streams的join实例

这里使用的是inner join,也有left join,也有outer join。如果要记录在时间窗口没有匹配上的记录,可以使用outer join,额外存储...

14510
来自专栏xingoo, 一个梦想做发明家的程序员

IP多播

                      1   多播地址                     IP多播地址采用D类IP地址确定多播的组,地址范围是224...

30050
来自专栏光变

Logback动态配置.01_Appender

在程序运行的时候,有的时候需要动态修改Logger的级别,增加、删除、修改Logger的Appender。

51020

扫码关注云+社区

领取腾讯云代金券