我正在尝试添加一个 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/