构建路径问题jta-1.0.1B.jar无法读取或它不是有效的ZIP

时间:2013-08-15 20:05:09

标签: maven build

我有以下错误导致项目上出现感叹号红点,并显示在问题/标记视图中。

'.... m2 / repository / javax / transaction / jta / 1.0.1B / jta-1.0.1B.jar'...无法读取或不是有效的ZIP文件

我已经检查了存储库并且jta-1.0.1B.jar在那里,我不明白为什么它无法读取。我之前在这个jar文件中遇到了一个不同的问题,还有其他依赖项,比如stax-1.0.jar和其他依赖项,并且在搜索类似的问题时,我看到由于在每个文件末尾添加了.lastUpdated的名称引起的。我通过仅删除.lastUpdated手动重命名它们。之后,构建日志显示成功,但我仍然看到标记视图中的错误以及由列出的问题导致的项目上的感叹号红点。 我试过这个解决方案:

查看Java.net maven 2 repo。 http://download.java.net/maven/2/javax/transaction/jta/1.0.1B/

将.jar,.jar.md5和.jar.sha1下载到[.m2 / javax / transaction / jta / 1.0.1B /]

使用:

mvn install:install-file -DgroupId = javax.transaction -DartifactId = jta -Dversion = 1.0.1B -Dpackaging = jar -Dfile = jta-1.0.1B.jar

但我仍有同样的问题。我该怎么办? 注意:这是我通过运行Maven clean在控制台中得到的[为什么它成功构建并且问题仍然存在?

 [INFO] Scanning for projects...
 [WARNING] 
 [WARNING] Some problems were encountered while building the effective model for prep.mucyo.com:subscription:war:0.0.1-SNAPSHOT
 [WARNING] 'dependencies.dependency.systemPath' for com.oracle:ojdbc14:jar should use a variable instead of a hard-coded path  C:/Eclipse_Juno/workspace/subscription/lib/ojdbc14.jar @ line 84, column 17
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the    stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such    malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building subscription maven webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ subscription ---
[INFO] Deleting C:\Eclipse_Juno\workspace\subscription\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.645s
[INFO] Finished at: Thu Aug 15 15:45:22 EDT 2013
[INFO] Final Memory: 3M/60M
[INFO] ------------------------------------------------------------------------

这是pom.xml的一部分

 <repositories> 
<repository>
    <id>JBoss repository</id>
    <url>http://repository.jboss.com/maven2/</url>
</repository>
 </repositories>
 <dependencies>
 <dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.11</version>
</dependency>
<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-spring-plugin</artifactId>
    <version>2.3.15.1</version>
</dependency> 
<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>2.3.15.1</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring</artifactId>
    <version>2.5.6.SEC03</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>3.2.4.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate</artifactId>
    <version>3.2.7.ga</version>
    <type>pom</type>
</dependency>
<dependency>
    <groupId>dom4j</groupId>
    <artifactId>dom4j</artifactId>
    <version>20040902.021138</version>
</dependency>
<dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.1.3</version>
</dependency>
<dependency>
    <groupId>commons-collections</groupId>
    <artifactId>commons-collections</artifactId>
    <version>20040616</version>
</dependency>
<dependency>
    <groupId>cglib</groupId>
    <artifactId>cglib</artifactId>
    <version>3.0</version>
</dependency>
<dependency>
    <groupId>antlr</groupId>
    <artifactId>antlr</artifactId>
    <version>20030911</version>
</dependency>

<dependency>
    <groupId>net.sf.stax</groupId>
    <artifactId>stax</artifactId>
    <version>1.0</version>
</dependency>
<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>7.0</version>
</dependency>
<dependency>
    <groupId>javax.transaction</groupId>
    <artifactId>jta</artifactId>
    <version>1.1</version>
</dependency>
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc14</artifactId>
    <version>14</version>
<scope>system</scope>
<systemPath>C:/Eclipse_Juno/workspace/subscription/lib/ojdbc14.jar</systemPath>
</dependency>
</dependencies>
<build>
 <finalName>subscription</finalName>
</build>

2 个答案:

答案 0 :(得分:0)

好像您下载的JAR已损坏。尝试删除“m2 / repository / javax / transaction / jta / 1.0.1B”中的所有内容并重复此过程。

我检查了中央存储库,并且没有任何具有此ID的JAR:http://search.maven.org/#artifactdetails%7Cjavax.transaction%7Cjta%7C1.0.1B%7Cjar

如果你的情况允许这样的改变,你也可以将“版本”标签改为“1.1”。

Maven构建成功完成可能是因为编译时不需要JTA类,也不需要任何测试单元(如果有的话)。

答案 1 :(得分:0)

要解决此问题,我必须删除存储库文件夹并重新构建。然后我遇到了我之前与Finding missing Maven artifacts类似的问题 我发现我首先丢失的文件问题是由这种依赖引起的

 <dependency>
  <groupId>dom4j</groupId>
  <artifactId>dom4j</artifactId>
  <version>20040902.021138</version>
 </dependency>

尝试解决类似于丢失文件的问题我只需要使用 dom4j 的不同版本

<dependency>
  <groupId>dom4j</groupId>
  <artifactId>dom4j</artifactId>
  <version>1.6.1</version>
</dependency> 

其他一切运作良好。