[英]Maven Install error after deleteing .m2 folder
我嘗試在具有某些依賴項的項目上運行maven安裝:
<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>
<groupId>com.example</groupId>
<artifactId>SpringBatchSample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>SpringBatchSample</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.8</jdk.version>
<spring.version>3.1.3.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.batch/spring-batch-core -->
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
<version>3.0.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-infrastructure</artifactId>
<version>3.0.7.RELEASE</version>
</dependency>
<!-- Spring Batch unit test -->
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-test</artifactId>
<version>3.0.7.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.batch/org.springframework.batch.core -->
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>org.springframework.batch.core</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
</dependencies>
<build>
<finalName>SpringBatchSample</finalName>
<pluginManagement>
<plugins>
<!-- Eclipse project -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<!-- Always download and attach dependencies source code -->
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<!-- Avoid type mvn eclipse:eclipse -Dwtpversion=2.0 -->
<wtpversion>2.0</wtpversion>
</configuration>
</plugin>
<!-- Set JDK Compiler Level -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>purge-local-dependencies</id>
<phase>process-sources</phase>
<!-- <goals>
<goal>purge-local-repository</goal>
</goals> -->
<configuration>
<excludes>
<exclude>[groupId1]:[artifactId1]</exclude>
<exclude>[groupId2]:[artifactId2]</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
第一次運行項目mvn install,它運行正常(已成功建立),但是第二次(“在代碼(pom.xml)中進行了一些更改之后”),我嘗試運行mvn install並進行maven拋出“打開錯誤zip文件”。
ERROR] error: error reading D:\Maven\Repository\org\springframework\spring-core\3.1.3.RELEASE\spring-core-3.1.3.RELEASE.jar; invalid LOC header (bad signature)
[ERROR] error: error reading D:\Maven\Repository\org\apache\commons\com.springsource.org.apache.commons.logging\1.1.1\com.springsource.org.apache.commons.logging-1.1.1.jar; error in opening zip file
[ERROR] error: error reading D:\Maven\Repository\org\aopalliance\com.springsource.org.aopalliance\1.0.0\com.springsource.org.aopalliance-1.0.0.jar; error in opening zip file
[ERROR] error: error reading D:\Maven\Repository\org\springframework\org.springframework.core\2.5.6.A\org.springframework.core-2.5.6.A.jar; invalid LOC header (bad signature)
在我提到某個網站后,我刪除了.m2文件夾,但反復收到相同的錯誤。
如果有人幫助我解決此錯誤可能是什么問題
提前致謝。
您是否嘗試過使用Maven重建項目? (maven =>更新=>強制..)
您可以確保settings.xml文件中路徑D:\\ Maven \\ Repository \\ org上的.m2。 因為錯誤讀取D:\\ Maven \\ Repository \\ org \\ springframework \\ org.springframework.core \\ 2.5.6.A \\ org.springframework.core-2.5.6.A.jar; ,
本地存儲庫maven的路徑將用於存儲工件。 默認值:$ {user.home} /。m2 /存儲庫。 如果更改了它,則應確保路徑正確。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.