背景

在使用 maven 构建项目的时候,我们有时候会发现,在 maven 提供的 https://mvnrepository.com/ 这个网站搜索出来的依赖。有时候并搜索不出来我们想要的依赖。这时候可以在 https://search.maven.org/ 中结合精准查询使用。


场景一:知道用的什么类,如何找到 maven 依赖

搜索:(其中 f 代表 full c 代表 class,知道类的完整路径的时候使用 )

1
fc:com.google.common.collect.ImmutableSet

搜索:(其中 c 是class,只知道类名的时候使用)

1
c:ImmutableSet

场景二:知道 Group ID 或者 Artifact ID , 如何找到 maven 依赖

搜索:(其中 g 代表 group id,知道 group id 的时候使用 )

1
g:com.alibaba

搜索:(其中 a 代表 artiface id,知道 artiface id 的时候使用 )

1
a:druid