Java Maven回购不起作用
我试图添加一个maven repositoryJava Maven回购不起作用,java,spring,maven,Java,Spring,Maven,我试图添加一个maven repositorymvnrepository.com,但似乎没有成功 <repository> <id>mvnrepository</id> <url>http://mvnrepository.com/artifact/</url> </repository> 因此,我非常确定有一些maven repo我不知道我认为您不需要添加任何额外的存储库标记来获取spri
mvnrepository.com
,但似乎没有成功
<repository>
<id>mvnrepository</id>
<url>http://mvnrepository.com/artifact/</url>
</repository>
因此,我非常确定有一些maven repo我不知道我认为您不需要添加任何额外的存储库标记来获取spring ldap工件 当工件不属于默认的maven repo(例如Jboss存储库)时,您只需要指定存储库,您需要将其添加到pom中以获取此存储库的任何工件 您只需在pom中添加以下依赖项,它就可以工作了
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
org.springframework.ldap
SpringLDAP
1.3.1.发布
您在下载工件时没有指定存储库吗?SpringLDAP工件是pom类型的。要指定除jar之外的任何工件,您需要指定类型。因此,您需要在pom中指定的工件是
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap</artifactId>
<version>1.3.1.RELEASE</version>
<type>pom</type>
</dependency>
org.springframework.ldap
SpringLDAP
1.3.1.发布
聚甲醛
希望这有帮助正如@techbost所提到的,maven无法从任何存储库解析spring-ldap-1.3.1.RELEASE.jar,因为这样的jar不存在 让我们看看发生了什么事。您可以按以下方式定义依赖项:
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
有人可能会认为这应该有效,因为现在您指示maven下载一个pom文件,该文件确实存在:
好吧,那也不行。这是因为pom
工件不是真正的依赖项(只是为了提醒-依赖项是添加到类路径中用于编译、测试和打包的文件,所以在类路径中有pom文件是没有意义的)
您实际需要的是以下两种情况之一:
- 使用SpringLDAP的特定子模块,例如
SpringLDAP核心
- 使用
模块的spring ldap
classifier。在本例中,您将把所有模块放在一个jar中。虽然这可能会简化您的配置,但强烈建议不要使用李>all
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
org.springframework.ldap
有关更多详细信息(setme-up
按钮将为您提供有关如何在Maven中使用它的说明)
Maven Central over https-是Maven设置说明
你为什么要加上这个。您正在搜索的SpringLDAP在Maven Central中可用,因此这是默认配置的,因此在这种情况下无需更改/添加存储库。您不应该将它添加到您的repositories中。在您的网络中是否有代理?spring工件在Maven Central中提供。因此,不需要补充存储库。我用maven build的最新日志更新了我的答案。抱歉,techboost。我没有看到您的pom
。工作完美。再次抱歉。
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap</artifactId>
<version>1.3.1.RELEASE</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap</artifactId>
<version>1.3.1.RELEASE</version>
<classifier>all</classifier>
</dependency>