Maven/IntelliJ import error: io.vertx.core does not exist

Maven/IntelliJ import error: io.vertx.core does not exist

我正在尝试让 vertx 库在 IntelliJ(w/maven)中编译

我在让 maven recognize/download vertx 依赖项时遇到了很多麻烦,但我能够通过命令行下载和安装 vertx 库来解决依赖项问题。现在我不再有 vertx 依赖项的问题,当我在 IntelliJ 中检查项目依赖项时,它具有正确的路径并且没有显示任何错误。 'project structure' 中的 Maven 库正确显示,我已经检查了 .jar 和 .java 文件的目录,它们都在那里。

我还将我的 maven 主目录设置为全新的 maven 安装: C:/程序Files/apache-maven-3.3.3 和设置文件到正确的文件: C:\Users[用户].m2\settings.xml 和本地存储库(maven 已经安装了必要的库) C:\Users[用户].m2\repository 这些目录与我安装的库和似乎正常工作的 Maven 目录对齐(在我重新安装库和重置缓存之前存在的小红线消失了)

但是,我仍然无法使用顶点库。

此外,此代码正在朋友 mac 上运行,但我 运行 windows 似乎无法编译它(java包不存在错误)。

我能够通过转到文件 - 项目结构 - 添加库 - Maven - 并在谷歌搜索模块名称后使用 Maven 安装模块(它是 io.vertx:vertx-core - io.vertx.core won'不要提出来)我能够使用 Maven 完全安装它并将它添加为 IntelliJ 中的依赖项。 HTH.

所以我花了很长时间,但我想通了。

这是一个缓存问题,也是 intelliJ 无法识别我正在使用 maven 导入快照库的问题。

1:出于某种原因,vertx 下载网站的 settings.xml 文件没有启用快照,但是(据我所知)他们系统的最新版本是 Maven 从中更新的快照不时。如果未启用快照,maven intelliJ 将不会 update/recognize 库。即使我已经使用 mvn install 安装了这些库,也会发生这种情况。 settings.xml 应如下所示:

  <profiles>
    <profile>
      <id>allow-snapshots</id>
      <activation><activeByDefault>true</activeByDefault></activation>
      <repositories>
        <repository>
          <id>snapshots-repo</id>
          <url>https://oss.sonatype.org/content/repositories/snapshots</url>
          <releases><enabled>false</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>

2:在我修复了上述问题后,我仍然有同样的问题,直到我删除了我以前用maven(/user/.m2/repositories)安装的本地缓存库。出于某种原因,intelliJ 无法识别它们。删除后,maven/intelliJ 重新下载它们,然后从那时起识别它们。