无法读取 org.apache.maven.plugins:maven-resources-plugin:jar:3.0.5 的工件描述符

新手上路,请多包涵

我想使用 spring boot 和 react js 构建一个网络应用程序(遵循 这里 的教程)。在 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: 在 http://repo.maven.apache.org/maven2 中找不到org.apache.maven.plugins:maven-resources-plugin:pom:3.0.5缓存在本地仓库中,解析不会重新尝试,直到中央的更新间隔结束或强制更新

编辑:我已经将 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>

错误:

[错误] 无法在项目 ema 上执行目标 com.github.eirslett:frontend-maven-plugin:1.2:install-node-and-yarn(安装节点和纱线):插件 com.github.eirslett:frontend-maven- plugin:1.2 requires Maven version 3.1.0 -> [求助1]

原文由 georgiana_e 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 610
2 个回答

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

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

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

适用于此处的最新版本是 3.0.2

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

原文由 Steve C 发布,翻译遵循 CC BY-SA 3.0 许可协议

我遇到了同样的问题然后我更改了代码 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>

原文由 Vijay Maurya 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题