我正在使用 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/