相关疑难解决方法(0)

强制Intellij IDEA重新读取所有maven依赖项

如何强制intellij想法重新读取/更新pom文件中指定的所有依赖项?

intellij-idea maven

283
推荐指数
10
解决办法
23万
查看次数

如何在IntelliJ IDEA中自动禁用Maven自动导入?

我相信这个设置可能会导致IntelliJ IDEA行为缓慢.我曾经得到一个弹出窗口,最后点击"自动执行此操作",现在它已启用,但我想再次将其关闭.如何禁用Maven'自动导入'?

intellij-idea maven intellij-13

23
推荐指数
4
解决办法
3万
查看次数

如何解决在中心(https://repo1.maven.org/maven2)找不到工件 javax.xml.bind:jaxb-api:pom:2.3.0-b161121.1438 的问题?

我正在迁移应用程序以使用 ehcache 3.10.0,但出现构建错误:无法在中央找到工件 javax.xml.bind:jaxb-api:pom:2.3.0-b161121.1438 ( https://repo1.1)。 maven.org/maven2

我在本地 .m2 目录中看到该文件: .m2\repository\javax\xml\bind\jaxb-api -- 2.3.0-b161121.1438

所以这是一个 IDE 问题,为什么它在我的本地构建中看不到,因为它确实存在于我的本地 .m2 上,但这个版本 (2.3.0-b161121.1438) 在 Maven 上仍然不可用,https://repo1。 maven.org/maven2/javax/xml/bind/jaxb-api/

因此构建因该工件错误而失败。关于如何解决它有什么建议吗?

java maven ehcache-3

10
推荐指数
1
解决办法
5784
查看次数

无法使用 MediaPlayer 类,找不到 javafx.media

我正在尝试构建一个虚拟钢琴应用程序,我需要 MediaPlayer 类来演奏音符,我的项目是一个带有 fxml、javafx 11.0.2 和 java 14 的模块化 Maven 项目。

我无法导入 MediaPlayer 类的问题,我尝试添加requires javafx.media;到我的 module-info.java 但它无论如何都无法识别它。这是我的 module-info.java

module org.project {
    requires javafx.controls;
    requires javafx.fxml;

    opens org.project to javafx.fxml;
    exports org.project;
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

还尝试下载库 jar 但它是空的。

还尝试在 pom.xml 文件中添加 Maven 依赖项,如下所示:

<!-- https://mvnrepository.com/artifact/org.openjfx/javafx.media -->
<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx.media</artifactId>
    <version>11.0.0-ea1</version>
    <type>pom</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)

我的 pom.xml 依赖项:

<dependencies>
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-fxml</artifactId>
        <version>11.0.2</version>
    </dependency>

    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-controls</artifactId>
        <version>11.0.2</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.openjfx/javafx.media -->
    <dependency>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx.media</artifactId>
        <version>15</version>
        <type>pom</type>
    </dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)

它显示未找到存储库。

javafx javafx-11

6
推荐指数
1
解决办法
9520
查看次数

导入 Spring 的 ReflectionTestUtils 类时出现问题

我正在开发一个名为acme-platform的多模块 Maven 项目,模块设置如下:

  1. acme 管理
  2. acme-通用
  3. acme-全球
  4. acme服务
  5. acme-客户端
  6. acme-注册
  7. acme 属性
  8. acme测试

(它们在acme-platform pom中按此顺序列出。)

在某些模块中,我已经能够使用 Spring 的 ReflectionTestUtils 类。然而,在最后一个模块acme-test中,我确实想使用它,但我无法使用。acme-test pom中没有依赖项部分,因此我添加了一个。这是 pom:

<?xml version="1.0" encoding="UTF-8"?>
Run Code Online (Sandbox Code Playgroud)

http://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
    <artifactId>acme-platform</artifactId>
    <groupId>com.awesomeness.acme</groupId>
    <version>1.21.0</version>
    <relativePath>../</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>

<artifactId>acme-test</artifactId>
<version>1.21.0</version>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
    </dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)

在添加依赖行之前,我无法将任何 Spring 的 api 导入到我的类中。导入这些行后,我能够访问大多数类,但不是全部,特别是 ReflectionTestUtils,即使它是 spring-test 模块的一部分(可以在此处验证)。

我正在使用 Intellij。我查看了其他问题(例如这个问题)的答案,以确保我正确更新了我的依赖项。无济于事。

有谁知道为什么我无法导入org.springframework.test.util.ReflectionTestUtilsacme -test? …

java spring intellij-idea spring-test maven

1
推荐指数
1
解决办法
5137
查看次数