mvn COMPILATION ERROR:打开zip文件时读取jar错误 [英] mvn COMPILATION ERROR : error reading jar error in opening zip file

查看:130
本文介绍了mvn COMPILATION ERROR:打开zip文件时读取jar错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有以下属性的x模块:

i have a x-module with those properties:

模块名称:x-datamodel

module-name: x-datamodel

这是pom.xml的一部分

this is a part of the pom.xml

<groupId>com.x.datamodel</groupId>
<artifactId>x</artifactId>
<version>1.0</version>
<packaging>jar</packaging>

我已使用以下命令行将项目安装在本地存储库中:

i have install the project in a local repository with this command line:

mvn install:install-file -Dfile=/Users/me/Documents/Projects/x-datamodel/target/classes/x-datamodel.jar -DgroupId=com.x.datamodel -DgeneratePom=true -DlocalRepositoryPath=/Users/me/Documents/Projects/me-repository  -DcreateChecksum=true -DartifactId=x -Dversion={1.0} -Dpackaging=jar

并将项目添加到bitbucket中.

and added the project in bitbucket.

我尝试将模块x集成到另一个项目y中.

I try to integrate the module x in another project y.

这里是y的pom.xml的一部分

here a part of the y's pom.xml

<dependency>
    <groupId>com.x.datamodel</groupId>
    <artifactId>x</artifactId>
    <version>${x.version}</version>
</dependency>

<repositories>
    <repository>
        <id>me-repository</id>
        <url>https://bitbucket.org/me/me-repository/src/master</url>
    </repository>
</repositories>

我可以在项目y中导入模块x的某些类,但是在构建y项目时出现此错误:

i can import some classes of the module x in the project y, but when i build the y project i get this error:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] error reading /Users/me/.m2/repository/com/x/datamodel/x/1.0/x-1.0.jar; error in opening zip file
[ERROR] error reading /Users/me/.m2/repository/com/x/datamodel/x/1.0/x-1.0.jar; error in opening zip file
[ERROR] /Users/me/Documents/Projects/y/src/main/java/com/y/server/serviceImpl/UserServiceImpl.java:[3,32] package com.x.datamodel.model does not exist
[ERROR] /Users/me/Documents/Projects/y/src/main/java/com/y/server/serviceImpl/UserServiceImpl.java:[18,12] cannot find symbol
  symbol:   class User
  location: class com.y.server.serviceImpl.UserServiceImpl
[ERROR] /Users/me/Documents/Projects/y/src/main/java/com/y/server/security/CustomUserDetailsService.java:[3,32] package com.x.datamodel.model does not exist
[INFO] 16 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:56 min
[INFO] Finished at: 2016-12-28T15:51:05+01:00
[INFO] Final Memory: 29M/209M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project y: Compilation failure: Compilation failure:
[ERROR] error reading /Users/me/.m2/repository/com/x/datamodel/x/1.0/x-1.0.jar; error in opening zip file
[ERROR] error reading /Users/me/.m2/repository/com/x/datamodel/x/1.0/x-1.0.jar; error in opening zip file
[ERROR] /Users/me/Documents/Projects/y/src/main/java/com/y/server/serviceImpl/UserServiceImpl.java:[3,32] package com.x.datamodel.model does not exist
[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

在安装存储库后,我将库放入以下路径:

after installing the repository i have the library into this path:

.m2/repository/com/x/datamodel/x/1.0/x-1.0.jar

为什么不呢?

.m2/repository/com/x-datamodel/x/1.0/x-1.0.jar

推荐答案

我倾向于认为文件已损坏.尝试将其删除并再次下载.

I tend to think the file is corrupted. Try deleting it and downloading it again.

这篇关于mvn COMPILATION ERROR:打开zip文件时读取jar错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆