2012-03-02 53 views
6

Tôi cố gắng chạy maven cài đặt trên dự án của tôi với một số phụ thuộc:maven cài đặt ném "lỗi trong việc mở file zip" chỉ sau khi thứ hai thử

<dependency> 
    <groupId>log4j</groupId> 
    <artifactId>log4j</artifactId> 
    <version>1.2.15</version> 
</dependency> 
<dependency> 
    <groupId>org.slf4j</groupId> 
    <artifactId>slf4j-log4j12</artifactId> 
    <version>1.5.2</version> 
</dependency> 
<dependency> 
    <groupId>ch.qos.logback</groupId> 
    <artifactId>logback-classic</artifactId> 
    <version>0.9.24</version> 
</dependency> 

<dependency> 
    <groupId>org.hibernate</groupId> 
    <artifactId>hibernate-core</artifactId> 
    <version>3.3.2.GA</version> 
</dependency> 
<dependency> 
    <groupId>org.hibernate</groupId> 
    <artifactId>hibernate-annotations</artifactId> 
    <version>3.4.0.GA</version> 
</dependency> 

lần đầu tiên tôi chạy mvn install nó chỉ chạy tốt (BUILD THÀNH CÔNG) nhưng lần thứ hai ("sau khi tôi thực hiện một số thay đổi trong mã") Tôi cố gắng chạy mvn install và maven ném "lỗi khi mở tệp zip".

[ERROR] error: error reading C:\Users\Idan\.m2\repository\javax\jms\jms\1.1\jms-   1.1.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\com\sun\jdmk\jmxtools\1.2.1\jmxtools-1.2.1.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\com\sun\jmx\jmxri\1.2.1\jmxri-1.2.1.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\ch\qos\logback\logback-classic\0.9.24\logback-classic-0.9.24.jar; error in opening zip file 

nhưng

nếu tôi loại bỏ log4j, slf4j, và logback-classoc phụ thuộc chạy maven cài đặt (BUILD SUCCESS) trở log4j, slf4j, và logback- cổ điển phụ thuộc chạy maven cài đặt nó chạy tốt (BUILD THÀNH CÔNG).

Điều gì có thể là vấn đề?

Cập nhật:

tôi cũng xóa tất cả .m2/thư mục reposetory tôi xóa tất cả các thư mục đích trong dự án của tôi sau đó tôi chạy mvn install và tôi nhận được

[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building d 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 
SLF4J: Defaulting to no-operation (NOP) logger implementation 
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.7.1/maven-surefire-plugin-2.7.1.pom 
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.7.1/maven-surefire-plugin-2.7.1.pom (10 KB at 28.9 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/apache/maven/surefire/surefire/2.7.1/surefire-2.7.1.pom 
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/surefire/surefire/2.7.1/surefire-2.7.1.pom (10 KB at 40.7 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-parent/18/maven-parent-18.pom 
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/maven-parent/18/maven-parent-18.pom (24 KB at 74.0 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/apache/apache/8/apache-8.pom 
Downloaded: http://repo1.maven.org/maven2/org/apache/apache/8/apache-8.pom (14 KB at 43.3 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.7.1/maven-surefire-plugin-2.7.1.jar 
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.7.1/maven-surefire-plugin-2.7.1.jar (29 KB at 50.1 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.pom 
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.pom (5 KB at 21.0 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.jar 
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.jar (23 KB at 40.8 KB/sec) 
[WARNING] The POM for log4j:log4j:jar:1.2.15 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details 
[WARNING] The POM for org.slf4j:slf4j-log4j12:jar:1.5.2 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details 
[WARNING] The POM for ch.qos.logback:logback-classic:jar:0.9.24 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details 
[WARNING] The POM for org.hibernate:hibernate-core:jar:3.3.2.GA is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details 
[WARNING] The POM for org.hibernate:hibernate-annotations:jar:3.4.0.GA is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details 
[WARNING] The POM for org.hibernate:hibernate-commons-annotations:jar:3.3.0.ga is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details 
[WARNING] The POM for org.hibernate:hibernate-entitymanager:jar:3.4.0.GA is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details 
[WARNING] The POM for junit:junit:jar:3.8.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details 
[WARNING] The POM for postgresql:postgresql:jar:9.1-901.jdbc4 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details 
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ d --- 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] Copying 4 resources 
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ d --- 
Downloading: http://repo1.maven.org/maven2/org/apache/maven/maven-toolchain/1.0/maven-toolchain-1.0.pom 
Downloaded: http://repo1.maven.org/maven2/org/apache/maven/maven-toolchain/1.0/maven-toolchain-1.0.pom (4 KB at 7.6 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-api/1.8.1/plexus-compiler-api-1.8.1.pom 
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-api/1.8.1/plexus-compiler-api-1.8.1.pom (805 B at 3.4 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler/1.8.1/plexus-compiler-1.8.1.pom 
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler/1.8.1/plexus-compiler-1.8.1.pom (4 KB at 11.9 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-components/1.1.18/plexus-components-1.1.18.pom 
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-components/1.1.18/plexus-components-1.1.18.pom (6 KB at 20.7 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus/2.0.7/plexus-2.0.7.pom 
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus/2.0.7/plexus-2.0.7.pom (17 KB at 57.6 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.5.5/plexus-utils-1.5.5.pom 
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.5.5/plexus-utils-1.5.5.pom (6 KB at 10.4 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-manager/1.8.1/plexus-compiler-manager-1.8.1.pom 
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-manager/1.8.1/plexus-compiler-manager-1.8.1.pom (713 B at 3.0 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-javac/1.8.1/plexus-compiler-javac-1.8.1.pom 
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-javac/1.8.1/plexus-compiler-javac-1.8.1.pom (710 B at 3.0 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compilers/1.8.1/plexus-compilers-1.8.1.pom 
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compilers/1.8.1/plexus-compilers-1.8.1.pom (2 KB at 3.9 KB/sec) 
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-api/1.8.1/plexus-compiler-api-1.8.1.jar 
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-manager/1.8.1/plexus-compiler-manager-1.8.1.jar 
Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-javac/1.8.1/plexus-compiler-javac-1.8.1.jar 
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-api/1.8.1/plexus-compiler-api-1.8.1.jar (20 KB at 39.4 KB/sec) 
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-manager/1.8.1/plexus-compiler-manager-1.8.1.jar (6 KB at 10.8 KB/sec) 
Downloaded: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-javac/1.8.1/plexus-compiler-javac-1.8.1.jar (13 KB at 12.3 KB/sec) 
[INFO] Compiling 4 source files to D:\projectsWorkspace\connectingtopostgresdbtests\d\target\classes 
[INFO] ------------------------------------------------------------- 
[ERROR] COMPILATION ERROR : 
[INFO] ------------------------------------------------------------- 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\log4j\log4j\1.2.15\log4j-1.2.15.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\slf4j\slf4j-log4j12\1.5.2\slf4j-log4j12-1.5.2.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\ch\qos\logback\logback-classic\0.9.24\logback-classic-0.9.24.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-core\3.3.2.GA\hibernate-core-3.3.2.GA.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-annotations\3.4.0.GA\hibernate-annotations-3.4.0.GA.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-commons-annotations\3.3.0.ga\hibernate-commons-annotations-3.3.0.ga.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-entitymanager\3.4.0.GA\hibernate-entitymanager-3.4.0.GA.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\postgresql\postgresql\9.1-901.jdbc4\postgresql-9.1-901.jdbc4.jar; error in opening zip file 
[INFO] 8 errors 
[INFO] ------------------------------------------------------------- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 11.573s 
[INFO] Finished at: Fri Mar 02 17:00:13 IST 2012 
[INFO] Final Memory: 13M/222M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project d: Compilation failure: Compilation failure: 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\log4j\log4j\1.2.15\log4j-1.2.15.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\slf4j\slf4j-log4j12\1.5.2\slf4j-log4j12-1.5.2.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\ch\qos\logback\logback-classic\0.9.24\logback-classic-0.9.24.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-core\3.3.2.GA\hibernate-core-3.3.2.GA.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-annotations\3.4.0.GA\hibernate-annotations-3.4.0.GA.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-commons-annotations\3.3.0.ga\hibernate-commons-annotations-3.3.0.ga.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\org\hibernate\hibernate-entitymanager\3.4.0.GA\hibernate-entitymanager-3.4.0.GA.jar; error in opening zip file 
[ERROR] error: error reading C:\Users\Idan\.m2\repository\postgresql\postgresql\9.1-901.jdbc4\postgresql-9.1-901.jdbc4.jar; error in opening zip file 
[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/MojoFailureExceptio 

cảm ơn vì sự giúp đỡ.

+0

Cố gắng dọn dẹp kho địa phương của bạn ('.m2 \ repository') và xem vấn đề vẫn còn. –

+0

Dường như bạn không thể xóa kho lưu trữ thành công. Hãy thử lại và đảm bảo rằng các tệp bị hỏng không tồn tại trước khi chạy lại maven. – jrudolph

Trả lời

4

bước 1.

Sạch Sẽ .m2\repository hoặc xóa thư mục cụ thể của bạn từ thư mục .m2\repository

bước 2.

chạy mvn clean install

bước3.

đảm bảo kết nối internet của bạn hoạt động tốt tại thời điểm chạy lệnh này, một số lần không thành công do sự cố kết nối.

+2

'mvn gói biên dịch sạch sẽ cài đặt' đó là sự thừa gấp đôi. gói bao gồm biên dịch và cài đặt bao gồm gói. Khi bạn bắt đầu maven với một vòng đời, nó cũng sẽ thực thi tất cả các pha trước pha đó. Vì vậy, thực sự 'mvn clean install' tương đương với lệnh của bạn. Xem [Tham chiếu Vòng đời Maven] (http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference) –

+0

Cảm ơn, Sean Tôi đã xóa những thứ vô ích – subodh

3

Trong trường hợp của tôi Nó được đưa ra dưới đây lỗi

error: error reading C:\Users\ppatel4.m2\repository\org\apache\xalan\xalan\2.7. 1\xalan-2.7.1.jar; error in opening zip file

Dưới đây là các bước tôi đã làm để sửa chữa nó.

  1. Manually tải Xalan-2.7.1.jar
  2. Hủy bỏ tất cả các file của: ~/.m2/kho/org/apache/Xalan/Xalan/2.7.1/
  3. Sao chép jar đó là bằng tay tải về vào vị trí: ~/.m2/kho/org/apache/Xalan/Xalan/2.7.1/

$ cp xalan-2.7.1.jar ~/.m2/repository/org/apache/xalan/xalan/2.7.1/ 

Xong nó ... Cố gắng thực hiện mvn của bạn sạch sẽ cài đặt lệnh.

+0

Tôi khắc phục sự cố bằng cách tải xuống và thay thế các lọ. hy vọng rằng giúp đỡ như câu trả lời này đã giúp tôi. –

1

Tôi hiện đang gặp phải sự cố tương tự. Thay đổi phiên bản plugin trình biên dịch maven thành 3.1 đã giúp.

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-compiler-plugin</artifactId> 
    <version>3.1</version> 
    <configuration> 
     <source>1.8</source> 
     <target>1.8</target> 
    </configuration> 
    </plugin> 
0

Có vẻ như do url kết nối không chính xác trong plugin maven của bạn. Tôi đã sử dụng kết nối VPN trước đó và do đó, nó đã khởi tạo nó với url đó không còn hợp lệ nữa.

rm -rf {PATH để .m2}/kho/org/apache/maven/plugins/

này nên sửa chữa nó

Các vấn đề liên quan