我正在尝试这里的spark-cassandra-connector-japi示例:
https://github.com/datastax/spark-cassandra-connector/blob/master/doc/7_java_api.md
maven构建失败,出现以下错误:
SimpleApp.java:[24,9]找不到符号[ERROR]符号:class CassandraRow [ERROR]位置:类SimpleApp
我的pom.xml如下所示
<project>
<groupId>com.example</groupId>
<artifactId>simple-project</artifactId>
<modelVersion>4.0.0</modelVersion>
<name>Simple Project</name>
<packaging>jar</packaging>
<version>1.0</version>
<dependencies>
<dependency> <!-- Spark dependency -->
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>com.datastax.spark</groupId>
<artifactId>spark-cassandra-connector_2.10</artifactId>
<version>1.5.0-M3</version>
</dependency>
<dependency>
<groupId>com.datastax.spark</groupId>
<artifactId>spark-cassandra-connector-java_2.10</artifactId>
<version>1.5.0-M3</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>2.1.9</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
<version>2.1.9</version>
</dependency>
</dependencies>
</project>
CassandraRow定义的类在哪里?我已经浏览了com.datastax.spark.connector.japi.CassandraJavaUtil包中的代码,并且没有在那里定义它。该示例要求仅静态导入com.datastax.spark.connector.japi以使示例正常工作。
任何指针都会非常感激。
答案 0 :(得分:0)
你可以通过import com.datastax.spark.connector.CassandraRow;
我使用的是与您相同的依赖项(无论版本如何)
<dependency>
<groupId>com.datastax.spark</groupId>
<artifactId>spark-cassandra-connector-java_2.10</artifactId>
<version>1.5.0-M2</version>
</dependency>