java - Maven 构建问题 : Installed external Maven 3. 6 但仍出现插件 2.5 的构建错误

标签 java eclipse maven

我正在使用 Eclipse Kepler 和 JDK 1.8。我在 eclipse 中创建了一个 Maven 项目。 eclipse自带的内置maven版本是3.0.4。创建 Maven 项目时出错

"Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5".

但是文件夹结构已创建。由于 eclipse 中内置的 Maven 无法构建它。我从 maven.apache.org 下载并设置了完整的 Maven。我通过运行命令 mvn -v 进行了验证,该命令显示了我安装的 Maven 版本,即 3.6。 然后我在 Maven_Project_Root/src/main/java 下添加了一个 java 类。然后尝试构建它。再次收到以下错误:

"Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5"

-如果有人能提供帮助,我们将不胜感激。

最佳答案

Maven 服务器不再支持 HTTP。您必须在本地 Maven 配置文件(位于您的主文件夹 yourname/.m2/settings.xml 中)中使用 HTTPS url 配置 Maven 存储库。

以下是您可以复制的示例:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
   <profiles>
      <profile>
         <id>artifactory</id>
         <repositories>
            <repository>
               <snapshots>
                  <enabled>false</enabled>
               </snapshots>
               <id>central</id>
               <name>libs-release</name>
               <url>https://repo1.maven.org/maven2/</url>
            </repository>
            <repository>
               <snapshots />
               <id>snapshots</id>
               <name>libs-snapshot</name>
               <url>https://repo1.maven.org/maven2/</url>
            </repository>
         </repositories>
         <pluginRepositories>
            <pluginRepository>
               <snapshots>
                  <enabled>false</enabled>
               </snapshots>
               <id>central</id>
               <name>plugins-release</name>
               <url>https://repo1.maven.org/maven2/</url>
            </pluginRepository>
            <pluginRepository>
               <snapshots />
               <id>snapshots</id>
               <name>plugins-snapshot</name>
               <url>https://repo1.maven.org/maven2/</url>
            </pluginRepository>
         </pluginRepositories>         
      </profile>
   </profiles>
   <activeProfiles>
      <activeProfile>artifactory</activeProfile>
   </activeProfiles>
</settings>

关于java - Maven 构建问题 : Installed external Maven 3. 6 但仍出现插件 2.5 的构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60354924/

相关文章:

java - 在 Android 应用程序中使用受 Java 启发的语言

java - 静态元模型主键属性未填充(NullPointerException)

c++ - 将预处理器添加到 Eclipse CDT 工具链

java - Apache CXF WSDL2java pom.xml 配置

java - 启动tomcat 7抛出两个异常,End事件和web.xml解析

java - 打印具有 4 个节点的树(简单森林)以检查基准

java - Lagom persistentEntityRegistry.register 不起作用

linux - 在 Ubuntu 12.04 中打开 eclipse juno 并出现错误 "No more handles ..."

java - 当项目资源管理器中的选择发生更改时,如何使用自定义模型更新属性 View ?

java.lang.NoClassDefFoundError : org/slf4j/LoggerFactory