java - Maven 仓库不工作

标签 java spring maven

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

相关文章:

Java JList 没有出现

java - 为什么会出现 GC 开销超出限制的情况?

Java:无法访问外部文件

java - 为什么这段代码没有产生预期的结果?

java - MvcUriComponentsBuilder.MethodArgumentBuilder 类型未定义方法 getBuild()

java - Spring Boot + Intellij Idea + Hibernate - 奇怪的堆栈跟踪

maven - JsonIgnore 注释不适用于 Lombok

java - Maven文件夹布局: Should I place tests in the EAR or its sub-modules?

java - Spring Boot 2.1.2在.yml mvc配置中使用类路径

java - OS X 上的 Maven : unable to find java. 语言问题