Home > Enterprise >  Spring Data Cassandra - build fails when dependency is added
Spring Data Cassandra - build fails when dependency is added

Time:02-24

I was following this guide https://www.baeldung.com/spring-data-cassandra-tutorial to try and get started with using Cassandra paired with spring boot, however, the Cassandra connector dependency:

<!-- 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>

Doesn't seem to contain the necessary modules for adding an AbstractCassandraConfiguration. When adding spring-boot-starter-data-cassandra as a dependancy it gives me the required modules to add Cassandra configurations, but my build fails with the error:

java: error reading `C:\Users\X\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar; zip END header not found`

Here is my 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&apos;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>

CodePudding user response:

My first approach would be going to:

C:\Users\X.m2\repository\com\google\code\findbugs\jsr305\3.0.2

and delete:

jsr305-3.0.2.jar

and then run a maven clean install or your goal

Sometimes the jars are downloaded corrupted

  • Related