xxxhelloworld 2012-09-06 23:22
浏览 315
已采纳

maven test问题

控制台中运行mvn clean test提示
build success

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.062 sec

但是在eclipse中run as maven build ,输入goals:clean test,点击OK,运行出错

[INFO] --- maven-surefire-plugin:2.7.1:test (default-test) @ helloworld ---
[WARNING] The POM for org.apache.maven.surefire:surefire-booter:jar:2.7.1 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.surefire:maven-surefire-common:jar:2.7.1 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.875s
[INFO] Finished at: Thu Sep 06 23:16:52 CST 2012
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.7.1:test (default-test) on project helloworld: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.7.1:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.7.1 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven.surefire:surefire-booter:jar:2.7.1, org.apache.maven.surefire:maven-surefire-common:jar:2.7.1: Failure to find org.apache.maven.surefire:surefire-booter:jar:2.7.1 in http://maven.xx.cn/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
[ERROR]

而且控制台和eclipse里面运行的时候提示都不同,version和platform encoding,如图:
[img]http://dl.iteye.com/upload/attachment/0073/4547/e7ff9062-1121-3f4b-8104-0471e2981e43.png[/img]

[img]http://dl.iteye.com/upload/attachment/0073/4549/5b040283-68a1-3d86-af83-0ea9f80dd54f.png[/img]
求指点!

  • 写回答

1条回答 默认 最新

  • jinnianshilongnian 2012-09-07 06:49
    关注

    1、默认使用平台编码进行过滤resources 可以强制指定:
    [code="java"]
    UTF-8
    UTF-8
    [/code]

    2、指定编译class的字符集
    [code="java"]
    org.apache.maven.plugins
    maven-compiler-plugin

    UTF-8


    [/code]

    UTF-8可以换成你平台编码

    3、native2asci插件,过滤properties (可选)
    [code="java"]
    org.codehaus.mojo
    native2ascii-maven-plugin
    1.0-alpha-1


    generate-resources

    native2ascii


    UTF-8
    资源文件源
    资源文件目标



    [/code]

    4、可以强制指定maven-surefire-plugin插件版本

    [code="java"]





    org.apache.maven.plugins

    maven-surefire-plugin

    2.10





    **/*Test.java 只包含测试类









    [/code]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测