最近开发的项目要部署到云服务器上,因此需要打个War放上去,但在打包的时候输出以下错误信息:
[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[8,16] 错误: 程序包org.junit不存在
[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[9,23] 错误: 程序包org.junit.runner不存在
[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[18,1] 错误: 找不到符号
[ERROR] 类 RunWith
/Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[37,2] 错误: 找不到符号
[INFO] 4 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.024 s
[INFO] Finished at: 2017-04-14T13:34:37+08:00
[INFO] Final Memory: 31M/280M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (default-testCompile) on project share: Compilation failure: Compilation failure:
[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[8,16] 错误: 程序包org.junit不存在
[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[9,23] 错误: 程序包org.junit.runner不存在
[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[18,1] 错误: 找不到符号
[ERROR] 类 RunWith
[ERROR] /Users/aven/Documents/workspace/share/src/test/java/com/weixiao/share/test/TestMyBatis.java:[37,2] 错误: 找不到符号
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/MojoFailureException
但是整个输出内容中,并没有看到 Maven 去下载 junit 包的输出,说明并不是因为网络等问题导致包没有下载下来。
由于执行 单元测试 是可以执行成功的,说明项目中不缺少 junit 的包;
打开 Pom.xml 查看,发现 pom.xml 中引用了两个版本的 junit 依赖;
删除一个低版本的之后 ,项目自动建构过程中在下载高版本的 junit 的包,说明有一个不存在;
下载成功,建构就成功了,没有再提示程序包 org.junit 不存在 的错误。
====================文档信息=======================
版权声明:非商用*转载-保持署名-注明出处
署名(BY) :testcs_dn(微wx笑)
文章出处:无知人生,记录点滴
==============欢迎关注我的个人微信订阅号(微wx笑)==========