gpt4 book ai didi

java - Maven 仓库不工作

转载 作者:行者123 更新时间:2023-11-29 05:19:55 28 4
gpt4 key购买 nike

我正在尝试添加一个 Maven 存储库 mvnrepository.com,但似乎我没有这样做。

<repository>
<id>mvnrepository</id>
<url>http://mvnrepository.com/artifact/</url>
</repository>

我可以清楚地看到我要找的 Artifact 就在那里http://mvnrepository.com/artifact/org.springframework.ldap/spring-ldap/1.3.1.RELEASE

但是我的 Maven 构建输出报告我它不是

Downloading: http://mvnrepository.com/artifact//org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.jar [INFO] Unable to find resource 'org.springframework.ldap:spring-ldap:jar:1.3.1.RELEASE' in repository mvnrepository (http://mvnrepository.com/artifact/)

我做错了什么? spring ldap Artifact 如何下载?

更新我尝试了几个 Artifact ,但都失败了

Downloading: http://repo1.maven.org/maven2//org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.jar [INFO] Unable to find resource 'org.springframework.ldap:spring-ldap:jar:1.3.1.RELEASE' in repository maven central repo (http://repo1.maven.org/maven2/) Downloading: http://download.java.net/maven/2//org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.jar [INFO] Unable to find resource 'org.springframework.ldap:spring-ldap:jar:1.3.1.RELEASE' in repository java.net repo (http://download.java.net/maven/2/) Downloading: http://maven.springframework.org/external//org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.jar [INFO] Unable to find resource 'org.springframework.ldap:spring-ldap:jar:1.3.1.RELEASE' in repository spring external (http://maven.springframework.org/external/) Downloading: http://search.maven.org//org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.jar [INFO] Unable to find resource 'org.springframework.ldap:spring-ldap:jar:1.3.1.RELEASE' in repository repo.jenkins-ci.org (http://search.maven.org/) Downloading: https://repository.jboss.org//org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.jar [INFO] Unable to find resource 'org.springframework.ldap:spring-ldap:jar:1.3.1.RELEASE' in repository mvnrepository (https://repository.jboss.org/) Downloading: http://repo1.maven.org/maven2//org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.jar [INFO] Unable to find resource 'org.springframework.ldap:spring-ldap:jar:1.3.1.RELEASE' in repository central (http://repo1.maven.org/maven2/)

如果我没有在 settings.xml 中定义任何存储库,则响应如下:

Downloading: http://repo1.maven.org/maven2/org/springframework/ldap/spring-ldap/1.3.1.RELEASE/spring-ldap-1.3.1.RELEASE.jar [INFO] Unable to find resource 'org.springframework.ldap:spring-ldap:jar:1.3.1.RELEASE' in repository central (http://repo1.maven.org/maven2)

更新此外,我在其他项目中使用 gradle,并且可以无缝运行

repositories {
mavenCentral()
mavenLocal()
}

dependencies {
compile 'org.springframework.ldap:spring-ldap:1.3.1.RELEASE'
}

所以我很确定有一些我不知道的maven repo

最佳答案

spring-ldap Artifact 是pom类型的。要指定 jar 以外的任何 Artifact ,您需要指定类型。所以你需要在你的 pom 中指定的 Artifact 是

<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap</artifactId>
<version>1.3.1.RELEASE</version>
<type>pom</type>
</dependency>

希望对你有帮助

关于java - Maven 仓库不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25200511/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com