【问题标题】:Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:3.0.5无法读取 org.apache.maven.plugins:maven-resources-plugin:jar:3.0.5 的工件描述符
【发布时间】:2017-09-24 18:20:20
【问题描述】:

我想使用 spring boot 和 react js 构建一个 web 应用程序(按照教程here)。 在 pom.xml 我添加了:

<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.0.5</version>
    <executions>
        <execution>
            <id>Copy frontend production build to resources</id>
            <phase>package</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <outputDirectory>${basedir}/target/classes</outputDirectory>
                <resources>
                    <resource>
                        <directory>src/main/app/build/</directory>
                        <filtering>true</filtering>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>

执行 mvn clean package 时,出现以下错误。 Maven 版本是 3.0.5。

插件 org.apache.maven.plugins:maven-resources-plugin:3.0.5 或其中之一 无法解析其依赖项:无法读取工件 描述符 org.apache.maven.plugins:maven-resources-plugin:jar:3.0.5: 失败 找到 org.apache.maven.plugins:maven-resources-plugin:pom:3.0.5 在 http://repo.maven.apache.org/maven2 被缓存在本地 存储库,在更新之前不会重新尝试解析 中心间隔已过或强制更新

编辑: 我已将 maven-resources-plugin 标记中的 maven 版本更改为 3.0.2 但现在出现错误:

<plugin>
    <groupId>com.github.eirslett</groupId>
    <artifactId>frontend-maven-plugin</artifactId>
    <version>1.2</version>
    <executions>
        <execution>
            <id>Install Node and Yarn</id>
            <goals>
                <goal>install-node-and-yarn</goal>
            </goals>
        </execution>

        <execution>
            <id>yarn install</id>
            <goals>
                <goal>yarn</goal>
            </goals>
            <configuration>
                <arguments>install</arguments>
            </configuration>
        </execution>

        <execution>
            <id>Frontend production build</id>
            <phase>package</phase>
            <goals>
                <goal>yarn</goal>
            </goals>
            <configuration>
                <arguments>run build</arguments>
            </configuration>
        </execution>
    </executions>
    <configuration>
        <nodeVersion>v7.2.0</nodeVersion>
        <yarnVersion>v0.18.0</yarnVersion>
        <installDirectory>.mvn</installDirectory>
        <workingDirectory>src/main/app</workingDirectory>
    </configuration>
</plugin>

错误:

[ERROR] 未能执行目标 com.github.eirslett:frontend-maven-plugin:1.2:install-node-and-yarn 在项目 ema 上(安装 Node 和 Yarn):插件 com.github.eirslett:frontend-maven-plugin:1.2 需要 Maven 版本 3.1.0 -> [帮助1]

【问题讨论】:

  • 您需要将版本更改为 3.0.2,因为它是最新的。之后,您需要使用 mvn package -U 重新启动 maven build,例如。 -U 将重新下载您的依赖项。
  • 另外,在教程中它使用 3.0.1 版本,所以你可能想要那个版本。

标签: java spring maven pom.xml


【解决方案1】:

问题是您的maven resource plugin repository 版本无效。

将您的 pom.xml 文件的存储库更改为此。

<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.0.2</version>
</dependency>

【讨论】:

    【解决方案2】:

    我遇到了同样的问题,然后我更改了代码 1.5.9.RELEASE 它现在可以正常工作了

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.9.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    

    【讨论】:

      【解决方案3】:

      简而言之,你的问题就在这里:

      <artifactId>maven-resources-plugin</artifactId>
      <version>3.0.5</version>
      

      此版本旨在传达maven-resources-plugin 的版本,而不是maven 本身。

      此处适用的最新版本是3.0.2

      我还建议您将整个 maven 安装升级到最新的 3.5.0 版本。

      【讨论】:

      • 如果我把 3.0.2 我在这里得到一个错误 frontend-maven-plugin (v 1.2)
      • 我得到:[错误] 无法在项目 ema 上执行目标 com.github.eirslett:frontend-maven-plugin:1.2:install-node-and-yarn(安装节点和纱线):插件 com.github.eirslett:frontend-maven-plugin:1.2 需要 Maven 版本 3.1.0 -> [帮助 1] 更改为 3.0.2 时
      • 获取生命周期配置未涵盖的插件执行:org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile(执行:default-testCompile,阶段:test-compile)
      猜你喜欢
      • 2019-02-27
      • 2021-08-12
      • 1970-01-01
      • 2016-05-08
      • 2011-10-02
      • 2017-02-12
      • 2011-07-03
      • 2017-08-20
      • 1970-01-01
      相关资源
      最近更新 更多