我的项目无法解析com.twitter:hbc-core:2.2.0依赖性。您可以在下面看到pom.xml文件。我尝试重新导入所有Maven项目,并且发现依赖项位于https://search.maven.org/artifact/com.twitter/hbc-core/2.2.0/jar的存储库中。使用的中央存储库是https://repo.maven.apache.org/maven2。这些类无法导入,并且alt + enter不能提供有意义的导入。
最小,完整,可验证的示例:
import com.twitter.hbc.core.endpoint.StatusesFilterEndpoint;
public class TwitterProducer {
public static void main(String[] args){
StatusesFilterEndpoint hosebirdEndpoint = new StatusesFilterEndpoint();
}
}
我在这里可能会想念什么?
<?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.github.simplestep</groupId>
<artifactId>kafka-beginners-course</artifactId>
<version>1.0</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.30</version>
</dependency>
<dependency>
<groupId>com.twitter</groupId>
<artifactId>hbc-core</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
</project>
答案 0 :(得分:1)
基于注释中的交流,看来Maven下载到本地class Solution:
def widthOfBinaryTree(self, root):
# table contains the first col_index for each level
first_col_index_table = {}
self.max_width = 0
def DFS(node, depth, col_index):
if node is None:
return
# if the entry is empty, set the value
if depth not in first_col_index_table:
first_col_index_table[depth] = col_index
self.max_width = max(self.max_width, col_index - first_col_index_table[depth] + 1)
# Preorder DFS, with the priority on the left child
DFS(node.left, depth+1, 2*col_index)
DFS(node.right, depth+1, 2*col_index + 1)
DFS(root, 0, 0)
return self.max_width
文件夹中的某些依赖项已损坏。
通过删除/重新命名此文件夹来强制Maven重新下载它们已解决了问题。