Maven 编译错误使用 Spring Boot with Cassandra
Maven Compilation Error using Spring Boot with Cassandra
我正在使用 Cassandra 存储库设置 Spring 启动应用程序。不过,Maven 已经变得不正常了,因为应用程序 停止了编译。 Spring Data Cassandra 没有得到正确处理。 "org.springframework.cassandra.core.mapping" 中的所有内容在本地都不存在 。看起来我还有其他包“...cassandra.core”没问题。
Cassandra bean 映射 类,如 @Table、@Column 等,在 Maven 编译中失败并显示 "cannot find symbol"。我尝试清理,甚至尝试删除我的 ./.m2/repository,但它无法编译。我预计一定会发生一些版本不匹配的情况,或者是时候开始使用 Gradle.
我有 运行 "jar tvf spring-data-cassandra-1.5.9.RELEASE.jar | grep 'mapping'" 和映射。* 类 都存在。 然而,"mvn clean compile" 结果多个同类错误:
[ERROR]
/media/kevvurs/ExtraDrive1/winshare/workspace/FPSJobsRedesign/FPSDistributionFilter/src/main/java/com/shc/scinventory/dfilter/data/DcUnitInfoBean.java:[4,55]
package org.springframework.data.cassandra.core.mapping does not exist
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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sample.app</groupId>
<artifactId>Filter</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Filter</name>
<description>Command-line tool</description>
<properties>
<maven.antrun.plugin.version>1.7</maven.antrun.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.8</jdk.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.72</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.17</version>
</dependency>
</dependencies>
<configuration>
<groups>dev</groups>
</configuration>
<executions>
<execution>
<phase>test</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
已解决
我正在集成一个 class,它使用不同的、非引导的 Spring 配置。我曾尝试从 org.springframework.data.cassandra.core.mapping.Table 中导入 @Table 和其他 Spring 数据注释 org.springframework.data.cassandra.mapping.Table 用于使用 spring-boot-starter-data-cassandra.
结论
有时我过于依赖 Intellij 和工具来重构和自动完成事情。如果我再注意一点,问题就会很明显。
我正在使用 Cassandra 存储库设置 Spring 启动应用程序。不过,Maven 已经变得不正常了,因为应用程序 停止了编译。 Spring Data Cassandra 没有得到正确处理。 "org.springframework.cassandra.core.mapping" 中的所有内容在本地都不存在 。看起来我还有其他包“...cassandra.core”没问题。
Cassandra bean 映射 类,如 @Table、@Column 等,在 Maven 编译中失败并显示 "cannot find symbol"。我尝试清理,甚至尝试删除我的 ./.m2/repository,但它无法编译。我预计一定会发生一些版本不匹配的情况,或者是时候开始使用 Gradle.
我有 运行 "jar tvf spring-data-cassandra-1.5.9.RELEASE.jar | grep 'mapping'" 和映射。* 类 都存在。 然而,"mvn clean compile" 结果多个同类错误:
[ERROR] /media/kevvurs/ExtraDrive1/winshare/workspace/FPSJobsRedesign/FPSDistributionFilter/src/main/java/com/shc/scinventory/dfilter/data/DcUnitInfoBean.java:[4,55] package org.springframework.data.cassandra.core.mapping does not exist
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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sample.app</groupId>
<artifactId>Filter</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Filter</name>
<description>Command-line tool</description>
<properties>
<maven.antrun.plugin.version>1.7</maven.antrun.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.8</jdk.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.72</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.17</version>
</dependency>
</dependencies>
<configuration>
<groups>dev</groups>
</configuration>
<executions>
<execution>
<phase>test</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
已解决
我正在集成一个 class,它使用不同的、非引导的 Spring 配置。我曾尝试从 org.springframework.data.cassandra.core.mapping.Table 中导入 @Table 和其他 Spring 数据注释 org.springframework.data.cassandra.mapping.Table 用于使用 spring-boot-starter-data-cassandra.
结论
有时我过于依赖 Intellij 和工具来重构和自动完成事情。如果我再注意一点,问题就会很明显。