问题描述
存档为所需库:项目'DocumentManager'中的'D:/mypath/.m2/repository/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar'无法读取或不是有效的ZIP文件
我已经检查过,并且jar文件其实是存在于url中。我甚至复制了一个jar的备份来覆盖该位置的jar文件,但也没有摆脱错误。我强迫maven更新,这没有解决问题。我也重新启动了eclipse,没有任何效果。
有一点,jta-1.0.1B.jar已经是jta-1.0.1B.jar.LatestUpdate,所以我缩短了名称为jta-1.0.1B.jar
在pom.xml中,错误消息的位置是第2行,内容如下:
xsi:schemaLocation =http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/行家-4.0.0.xsd>
当我从,pom.xml中的错误消失了,但被新的错误所替代.java类文件指示Document类的5种方法无效。
我读了和,但是我没有使用struts,我已经包括了hibernate的3.3.2.ga,而我在pom.xml中没有一个存储库标签(这个表示甚至没有解决问题),所以我不认为这是重复的。
任何人都可以提出解决这个问题的方法?如果我需要一个存储库标签,我该把它放在哪里?还有什么我可以改变以适应其添加?
对于任何好奇的人,我的pom.xml被包含以供参考如下:
<?xml version =1.0encoding =UTF-8?>< project xmlns =http://maven.apache。 org / POM / 4.0.0xmlns:xsi =http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation =http://maven.apache.org/POM/ 4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">
< modelVersion> 4.0.0< / modelVersion>
< packaging> war< / packaging>
< version> 0.0.1-SNAPSHOT< / version>
< description>< / description>
< build>
< plugins>
< plugin>
< artifactId> maven-compiler-plugin< / artifactId>
< configuration>
< source> 1.5< / source>
< target> 1.5< / target>
< / configuration>
< / plugin>
< plugin>
< artifactId> maven-war-plugin< / artifactId>
< version> 2.0.1< / version>
< / plugin>
< / plugins>
< / build>
<依赖关系>
<依赖关系>
< groupId> javax.servlet< / groupId>
< artifactId> servlet-api< / artifactId>
< version> 2.5< / version>
< / dependency>
<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-beans< / artifactId>
< version> $ {org.springframework.version}< / version>
< / dependency>
<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-jdbc< / artifactId>
< version> $ {org.springframework.version}< / version>
< / dependency>
<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-web< / artifactId>
< version> $ {org.springframework.version}< / version>
< / dependency>
<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-webmvc< / artifactId>
< version> $ {org.springframework.version}< / version>
< / dependency>
<依赖关系>
< groupId> org.springframework< / groupId>
< artifactId> spring-orm< / artifactId>
< version> $ {org.springframework.version}< / version>
< / dependency>
<依赖关系>
< groupId> taglibs< / groupId>
< artifactId> standard< / artifactId>
< version> 1.1.2< / version>
< / dependency>
<依赖关系>
< groupId> javax.servlet< / groupId>
< artifactId> jstl< / artifactId>
< version> 1.1.2< / version>
< / dependency>
<依赖关系>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-entitymanager< / artifactId>
< version> 3.3.2.GA< / version>
< / dependency>
<依赖关系>
< groupId> mysql< / groupId>
< artifactId> mysql-connector-java< / artifactId>
< version> 5.1.10< / version>
< / dependency>
<依赖关系>
< groupId> commons-dbcp< / groupId>
< artifactId> commons-dbcp< / artifactId>
< version> 20030825.184428< / version>
< / dependency>
<依赖关系>
< groupId> commons-pool< / groupId>
< artifactId> commons-pool< / artifactId>
< version> 1.5.4< / version>
< / dependency>
<依赖关系>
< groupId> commons-fileupload< / groupId>
< artifactId> commons-fileupload< / artifactId>
< version> 1.2.1< / version>
< / dependency>
<依赖关系>
< groupId> commons-io< / groupId>
< artifactId> commons-io< / artifactId>
< version> 1.3< / version>
< / dependency>
<! - 修复JSPServletException的依赖关系 - >
<依赖关系>
< groupId> org.apache.tomcat< / groupId>
< artifactId> jsp-api< / artifactId>
< version> 6.0.32< / version>
< scope>已提供< / scope>
< / dependency>
< / dependencies>
<属性>
< org.springframework.version> 3.2.4.RELEASE< /org.springframework.version>
< project.build.sourceEncoding> UTF-8< /project.build.sourceEncoding>
< / properties>
< groupId> DocumentManager< / groupId>
< artifactId> DocumentManager< / artifactId>
< / project>
要修复这样的问题,让Maven下载文件再次:
- 删除文件夹
D:/mypath/.m2/repository/javax/transaction/jta
- 使用
-U
运行Maven,以便再次尝试破碎的下载。
应该尝试再次下载文件,并清理本地存储库中的任何残留。
如果Eclipse仍然抱怨JAR文件已损坏:
- 刷新您的项目(或从上下文菜单)
- 清理项目
- 尝试打开JAR文件。也许这真的是破坏了。
如果JAR文件已损坏,请再次删除该文件夹并再次运行Maven。请注意Maven用于下载存档的URL,并与该站点的管理员联系。
In an eclipse maven project using spring web mvc, I am getting the following error in the Markers tab:
Archive for required library: 'D:/mypath/.m2/repository/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar' in project 'DocumentManager' cannot be read or is not a valid ZIP file
I have checked, and the jar file is in fact present in the url indicated. I even copied a backup of the jar to overwrite the jar file in that location, but that did not get rid of the error either. I forced maven to update, which did not solve the problem. I also restarted eclipse to no effect.
At one point, jta-1.0.1B.jar had been jta-1.0.1B.jar.LatestUpdate, so I shortened the name to jta-1.0.1B.jar
In pom.xml, the location of the error message is line 2, which reads as follows:
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
When I download jta-1.0.1B.jar manually from this url, the error in pom.xml goes away but is replaced with new errors in .java class files indicating that 5 methods of the Document class are not valid.
I read this and this, but I am not using struts, I am already including 3.3.2.ga of hibernate, and I do not have a repository tag in pom.xml (which this said did not even solve the problem anyway), so I do not think this is a duplicate.
Can anyone suggest a way to fix this problem? If I need a repository tag, where do I put it? And what else do I change to accommodate its addition?
For anyone who is curious, my pom.xml is included for reference as follows:
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<description></description>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.3.2.GA</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.10</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>20030825.184428</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.5.4</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.3</version>
</dependency>
<!-- dependency to fix JSPServletException -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>jsp-api</artifactId>
<version>6.0.32</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<org.springframework.version>3.2.4.RELEASE</org.springframework.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<groupId>DocumentManager</groupId>
<artifactId>DocumentManager</artifactId>
</project>
To fix issues like that, let Maven download the files again:
- Delete the folder
D:/mypath/.m2/repository/javax/transaction/jta
- Run Maven with
-U
so it tries broken downloads again.
That should try to download the file again and clean up any "residue" in your local repository.
If Eclipse still complains that the JAR file is corrupt:
- Refresh your project ( or from the context menu)
- Clean the project
- Try to open the JAR file. Maybe it's really corrupt.
If the JAR file is corrupt, delete the folder again and run Maven once more. Note the URLs which Maven used to download the archive and contact the administrator of that site.
这篇关于eclipse maven错误:项目中所需的库的存档无法读取或不是有效的ZIP文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!