【问题标题】:Maven could not find artifact command in eclipse spring-boot-starter-parentMaven 在 Eclipse spring-boot-starter-parent 中找不到工件命令
【发布时间】:2019-10-15 17:14:35
【问题描述】:

当我尝试在 Eclipse 上运行任何 Maven 命令时出现错误。

错误信息:

[ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.me.learn:first-application:0.0.1-SNAPSHOT: 
Failure to find org.springframework.boot:spring-boot-starter-parent:pom:2.1.5-RELEASE 
in https://repo.maven.apache.org/maven2 was cached in the local repository, 
resolution will not be reattempted until the update 
interval of central has elapsed or updates are forced and 'parent.relativePath' 
points at wrong local POM @ line 6, column 10

我检查的内容:

  1. Project build error: Non-resolvable parent POM. Failure to transfer org.springframework.boot:spring-boot-starter-parent

  2. 目录/home/{anonymous}/.m2/repository/home/{anonymous}/.m2/repository/org/springframework/boot/spring-boot-starter-parent

包含文件:spring-boot-starter-parent-2.1.5-RELEASE.pom.lastUpdated

  1. 手动清理存储库,并在 eclipse 上运行 clean。

  2. 我在 eclipse 中的 settings.xml 配置设置到了正确的位置,我在本地存储库中的 eclipse 配置也被定义好了。

  3. 未定义代理。

关于我的配置和环境的信息:

我在 Ubuntu 上使用 eclipse。

settings.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <localRepository>/home/{anonymous}/.m2/repository</localRepository>
  <interactiveMode>true</interactiveMode>
  <usePluginRegistry>false</usePluginRegistry>
  <offline>false</offline>

</settings>

pom.xml 文件:

   <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/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>

        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.1.5-RELEASE</version>
        </parent>

        <groupId>com.me.learn</groupId>
        <artifactId>first-application</artifactId>
        <packaging>pom</packaging>
        <version>0.0.1-SNAPSHOT</version>
        <name>first-application</name>
        <url>http://maven.apache.org</url>

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

        <build>
            <finalName>first-application</finalName>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    </project>

Maven 版本:

Apache Maven 3.5.2
Maven home: /usr/share/maven
Java version: 1.8.0_171, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.10.0-37-generic", arch: "amd64", family: "unix"

【问题讨论】:

  • &lt;version&gt;2.1.5-RELEASE&lt;/version&gt; 应该是&lt;version&gt;2.1.5.RELEASE&lt;/version&gt;
  • 非常感谢巴拉特!

标签: java spring eclipse maven spring-boot


【解决方案1】:
  • 蛮力/清理您的 ~/.m2/repository 目录/只需删除它,它将在下一次构建时重新填充。
  • settings.xml:检查存储库的“updatePolicy”。通常,发行版从不检查更新,并且 SNAPSHOT 具有默认值。我经常设置间隔:13(13分钟)

【讨论】:

    猜你喜欢
    • 2021-09-20
    • 2018-01-10
    • 2017-08-10
    • 2023-02-07
    • 2021-03-29
    • 2022-07-30
    • 2022-12-15
    • 2021-10-22
    • 2014-12-31
    相关资源
    最近更新 更多