【问题标题】:Generated Spring pom.xml causes error "Error while fetching http://maven.apache.org/POM/4.0.0"生成的 Spring pom.xml 导致错误“获取 http://maven.apache.org/POM/4.0.0 时出错”
【发布时间】:2020-11-11 10:56:44
【问题描述】:

(我知道有类似的问题 - 但尝试了解决方案后我仍然卡住了)

我正在尝试使用 Spring 的 Demo 项目,但无法使生成的 pom.xml 在 IntelliJ 下工作,我尝试了 IntelliJ 建议的解决 URI 未注册的解决方案 - 但这只会导致名义上的错误。

起初我认为这是一个网络错误,但在浏览器中加载网页时出现 404。这让我相信这是我的项目设置在某种程度上存在的问题。

我通过在 IntelliJ 中打开 pom.xml 然后单击“作为项目打开”来导入项目。

我的pom.xml如下:

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.5.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>prs.ttg.spring</groupId>
    <artifactId>test</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>test</name>
    <description>Test project for Spring Boot</description>

    <properties>
        <java.version>15</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

没有任何依赖项被加载,我终生无法找到可行的解决方案。

感谢帮助,并理解这是否只是一个愚蠢的问题 - 我是一个愚蠢的人

【问题讨论】:

  • 如果从命令行执行maven会发生什么。
  • 该 pom 作为项目加载到 IDEA 时对我有用。你说你做了一些导致你的标题错误的事情。在那之前发生了什么?
  • 您检查任何代理设置吗?
  • @M.Deinum 我该怎么做?抱歉,我是 Maven 新手
  • @tgdavies 它说“maven.apache.org/POM/4.0.0” URI 未注册 - 解决方案是(据说)获取资源

标签: java xml spring maven intellij-idea


【解决方案1】:

确保您在 Preferences | 中启用了 Maven 捆绑插件插件。如果您使用代理 - 在 IDE 中设置代理设置:https://www.jetbrains.com/help/idea/settings-http-proxy.html

如果您启用了 Maven 插件,则通过 File | 打开项目新 | Project from Existing Sources 并选择 pom.xml 文件来导入项目。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-22
    • 2020-01-03
    • 2021-01-20
    • 2019-04-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-02
    相关资源
    最近更新 更多