【发布时间】:2021-06-16 21:12:16
【问题描述】:
我在尝试构建项目时遇到以下错误。该项目是 spring 项目,使用 IntelliJ 和 java 8。
Could not find artifact org.springframework.data:spring-data-bom:pom:2021.0.0-M2 in nexus (http://maven:8081/nexus/content/groups/public)
有没有办法通过setting.xml修复? 我无法访问 http://maven:8081/nexus/content/groups/public 上的任何配置
这是我的设置。
<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">
<servers>
<server>
<id>releases</id>
<username>me</username>
<password>mee</password> <!-- impossible password here :-) -->
</server>
<server>
<id>snapshots</id>
<username>me</username>
<password>mee</password> <!-- impossible password here :-) -->
</server>
<server>
<id>nexus</id>
<username>me</username>
<password>mee</password> <!-- impossible password here :-) -->
</server>
</servers>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://maven:8081/nexus/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>https://mvnrepository.com/repos/central</url>
<releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
<snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://mvnrepository.com/repos/central</url>
<releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
<snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>defaultprofile</id>
<!-- if you want to be able to switch to the defaultprofile profile put this in the active profile -->
<repositories>
<repository>
<id>maven.default</id>
<name>default maven repository</name>
<url>http://repo1.maven.org/maven2</url>
<releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
<snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
</repository>
<repository>
<id>maven.snapshot</id>
<name>Maven snapshot repository</name>
<releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
<url>http://people.apache.org/repo/m2-snapshot-repository</url>
<snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
</repository>
<repository>
<id>vaadin-addons</id>
<url>https://maven.vaadin.com/vaadin-addons</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
【问题讨论】:
-
首先这些条目:
https://mvnrepository.com/repos/central完全错误...删除它们。其次这些条目:http://repo1.maven.org/maven2不需要。也删除它们。如果您喜欢使用 Spring Boot 的里程碑版本,则必须将其添加到您的存储库管理器中,而不是您的 pom 文件中,因为您已经在使用存储库管理器。 -
请评论我的答案,而不是编辑它。
标签: java maven repository settings pom.xml