Spring Data Cassandra - 添加依赖项时构建失败
Spring Data Cassandra - build fails when dependency is added
我按照本指南 https://www.baeldung.com/spring-data-cassandra-tutorial 尝试开始使用与 spring 启动配对的 Cassandra,但是,Cassandra 连接器依赖项:
<!-- https://mvnrepository.com/artifact/com.datastax.oss/java-driver-core -->
<dependency>
<groupId>com.datastax.oss</groupId>
<artifactId>java-driver-core</artifactId>
<version>4.14.0</version>
</dependency>
似乎不包含添加 AbstractCassandraConfiguration 的必要模块。添加 spring-boot-starter-data-cassandra 作为依赖项时,它为我提供了添加 Cassandra 配置所需的模块,但我的构建失败并显示错误:
java: error reading `C:\Users\X\.m2\repository\com\google\code\findbugs\jsr305.0.2\jsr305-3.0.2.jar; zip END header not found`
这是我的 pom.xml:
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.morpheus</groupId>
<artifactId>reportdbgateway</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>reportdbgateway</name>
<description>Charlie's software engineering assignment cassandra db gateway</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
我的第一个方法是:
C:\Users\X.m2\repository\com\google\code\findbugs\jsr305.0.2
并删除:
jsr305-3.0.2.jar
然后 运行 maven 全新安装或您的目标
有时下载的 jar 文件已损坏
我按照本指南 https://www.baeldung.com/spring-data-cassandra-tutorial 尝试开始使用与 spring 启动配对的 Cassandra,但是,Cassandra 连接器依赖项:
<!-- https://mvnrepository.com/artifact/com.datastax.oss/java-driver-core -->
<dependency>
<groupId>com.datastax.oss</groupId>
<artifactId>java-driver-core</artifactId>
<version>4.14.0</version>
</dependency>
似乎不包含添加 AbstractCassandraConfiguration 的必要模块。添加 spring-boot-starter-data-cassandra 作为依赖项时,它为我提供了添加 Cassandra 配置所需的模块,但我的构建失败并显示错误:
java: error reading `C:\Users\X\.m2\repository\com\google\code\findbugs\jsr305.0.2\jsr305-3.0.2.jar; zip END header not found`
这是我的 pom.xml:
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.morpheus</groupId>
<artifactId>reportdbgateway</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>reportdbgateway</name>
<description>Charlie's software engineering assignment cassandra db gateway</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
我的第一个方法是:
C:\Users\X.m2\repository\com\google\code\findbugs\jsr305.0.2
并删除:
jsr305-3.0.2.jar
然后 运行 maven 全新安装或您的目标
有时下载的 jar 文件已损坏