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

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]

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

报告相同问题?

悬赏问题

  • ¥30 Matlab打开默认名称带有/的光谱数据
  • ¥50 easyExcel模板 动态单元格合并列
  • ¥15 res.rows如何取值使用
  • ¥15 在odoo17开发环境中,怎么实现库存管理系统,或独立模块设计与AGV小车对接?开发方面应如何设计和开发?请详细解释MES或WMS在与AGV小车对接时需完成的设计和开发
  • ¥15 CSP算法实现EEG特征提取,哪一步错了?
  • ¥15 游戏盾如何溯源服务器真实ip?需要30个字。后面的字是凑数的
  • ¥15 vue3前端取消收藏的不会引用collectId
  • ¥15 delphi7 HMAC_SHA256方式加密
  • ¥15 关于#qt#的问题:我想实现qcustomplot完成坐标轴
  • ¥15 下列c语言代码为何输出了多余的空格