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]

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

报告相同问题?

悬赏问题

  • ¥20 C#调用虚拟键盘TabTip.exe
  • ¥15 Qt4代码实现下面的界面
  • ¥15 CCS离散化传递函数与仿真不一致
  • ¥15 prism提示我reinstall prism 如何解决
  • ¥15 asp.core 权限控制怎么做,需要控制到每个方法
  • ¥20 while循环中OLED显示中断中的数据不正确
  • ¥15 这个视频里的stm32f4代码是怎么写的
  • ¥15 JNA调用DLL报堆栈溢出错误(0xC00000FD)
  • ¥15 请教SGeMs软件的使用
  • ¥15 自己用vb.net编写了一个dll文件,如何只给授权的用户使用这个dll文件进行打包编译,未授权用户不能进行打包编译操作?