【发布时间】:2016-07-20 04:55:36
【问题描述】:
我的 pom.xml 中有以下依赖项。
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.2</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.4.0</version>
</dependency>
当我做 mvn 测试时,控制台输出如下:
[ERROR] error reading C:\Users\harish\.m2\repository\com\jayway\restassured\rest-assured\2.4.0\rest-assured-2.4.0.jar; error in opening zip file
[ERROR] error reading C:\Users\harish\.m2\repository\mysql\mysql-connector-java\6.0.2\mysql-connector-java-6.0.2.jar; error in opening zip file
[ERROR] error reading C:\Users\harish\.m2\repository\junit\junit\4.12\junit-4.12.jar; error in opening zip file
这些是出现的错误。我不知道如何解决我的项目问题。我通过网上搜索了几种解决方案。但是,没有帮助。如果有人知道这种错误的原因,请帮助。提前致谢。
【问题讨论】:
-
不相关,但您可以考虑将
<scope>test</scope>添加到您的junit 依赖项中,以表明“该依赖项不是应用程序正常使用所必需的,仅可用于测试编译和执行阶段。” -
猜想:你在代理后面,它搞砸了依赖项的下载。删除它们(每个文件夹,如
~\.m2\repository\junit\junit\4.12),正确设置代理,然后重试。 -
只是一个疑问。我可以删除 repo 中的所有文件夹吗?