Ivar Reukers
Ivar Reukers

Reputation: 7719

Maven - Not finding LDAP jar file

I'm trying to create a project having the LDAP (specifically com.sun.jndi.ldap.LdapCtxFactory) jar.

Now Mavencentral provides the com.sun.jndi:ldap:1.2.4 option, showing the following code for the dependency:

<!-- https://mvnrepository.com/artifact/com.sun.jndi/ldap -->
<dependency>
    <groupId>com.sun.jndi</groupId>
    <artifactId>ldap</artifactId>
    <version>1.2.4</version>
</dependency>

Now I added this exact snippet to my pom.xml (which contains more dependencies from mvnrepository which work)

My <repositories>

<repositories>
        <repository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </repository>
        <repository>
            <id>mvnrepository</id>
            <url>http://mvnrepository.com/artifact/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </pluginRepository>
    </pluginRepositories>

On hovering the dependency tag it shows: 'Cannot find artifact ...'

When running mvn clean install -X it shows me the error logs for searching the jar file in the repo.spring.io instead of mvncentral where I was expecting.

Error log:

[DEBUG] =======================================================================
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=111, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=60, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=16, ConflictResolver.conflictItemCount=100, DefaultDependencyCollector.collectTime=353, DefaultDependencyCollector.transformTime=16}
[DEBUG] org.springframework:gs-rest-service:war:0.1.0
[DEBUG]    org.springframework.boot:spring-boot-starter-web:jar:1.4.0.RELEASE:compile
[DEBUG]       org.springframework.boot:spring-boot-starter:jar:1.4.0.RELEASE:compile
[DEBUG]          org.springframework.boot:spring-boot:jar:1.4.0.RELEASE:compile
[DEBUG]          org.springframework.boot:spring-boot-autoconfigure:jar:1.4.0.RELEASE:compile
[DEBUG]          org.springframework.boot:spring-boot-starter-logging:jar:1.4.0.RELEASE:compile
[DEBUG]             ch.qos.logback:logback-classic:jar:1.1.7:compile
[DEBUG]                ch.qos.logback:logback-core:jar:1.1.7:compile
[DEBUG]             org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[DEBUG]             org.slf4j:jul-to-slf4j:jar:1.7.21:compile
[DEBUG]             org.slf4j:log4j-over-slf4j:jar:1.7.21:compile
[DEBUG]          org.yaml:snakeyaml:jar:1.17:runtime
[DEBUG]       org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.0.RELEASE:compile
[DEBUG]          org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.4:compile
[DEBUG]          org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.4:compile
[DEBUG]          org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.4:compile
[DEBUG]       org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[DEBUG]          javax.validation:validation-api:jar:1.1.0.Final:compile
[DEBUG]          org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile (version managed from 3.2.1.Final by org.springframework.boot:spring-boot-dependencies:1.4.0.RELEASE)
[DEBUG]          com.fasterxml:classmate:jar:1.3.1:compile (version managed from 1.1.0 by org.springframework.boot:spring-boot-dependencies:1.4.0.RELEASE)
[DEBUG]       com.fasterxml.jackson.core:jackson-databind:jar:2.8.1:compile
[DEBUG]          com.fasterxml.jackson.core:jackson-annotations:jar:2.8.1:compile (version managed from 2.8.0 by org.springframework.boot:spring-boot-dependencies:1.4.0.RELEASE)
[DEBUG]          com.fasterxml.jackson.core:jackson-core:jar:2.8.1:compile
[DEBUG]       org.springframework:spring-web:jar:4.3.2.RELEASE:compile
[DEBUG]          org.springframework:spring-aop:jar:4.3.2.RELEASE:compile
[DEBUG]          org.springframework:spring-context:jar:4.3.2.RELEASE:compile
[DEBUG]       org.springframework:spring-webmvc:jar:4.3.2.RELEASE:compile
[DEBUG]          org.springframework:spring-expression:jar:4.3.2.RELEASE:compile
[DEBUG]    org.springframework.boot:spring-boot-starter-test:jar:1.4.0.RELEASE:test
[DEBUG]       org.springframework.boot:spring-boot-test:jar:1.4.0.RELEASE:test
[DEBUG]       org.springframework.boot:spring-boot-test-autoconfigure:jar:1.4.0.RELEASE:test
[DEBUG]       com.jayway.jsonpath:json-path:jar:2.2.0:test
[DEBUG]          net.minidev:json-smart:jar:2.2.1:test
[DEBUG]             net.minidev:accessors-smart:jar:1.1:test
[DEBUG]                org.ow2.asm:asm:jar:5.0.3:test
[DEBUG]       org.assertj:assertj-core:jar:2.5.0:test
[DEBUG]       org.mockito:mockito-core:jar:1.10.19:test
[DEBUG]          org.objenesis:objenesis:jar:2.1:test
[DEBUG]       org.hamcrest:hamcrest-core:jar:1.3:compile
[DEBUG]       org.hamcrest:hamcrest-library:jar:1.3:test
[DEBUG]       org.skyscreamer:jsonassert:jar:1.3.0:test
[DEBUG]          org.json:json:jar:20140107:test (version managed from 20090211 by org.springframework.boot:spring-boot-dependencies:1.4.0.RELEASE)
[DEBUG]       org.springframework:spring-core:jar:4.3.2.RELEASE:compile
[DEBUG]    org.springframework:spring-jdbc:jar:4.3.2.RELEASE:compile
[DEBUG]       org.springframework:spring-beans:jar:4.3.2.RELEASE:compile
[DEBUG]       org.springframework:spring-tx:jar:4.3.2.RELEASE:compile
[DEBUG]    org.springframework:spring-test:jar:4.3.2.RELEASE:compile
[DEBUG]    org.jetbrains.kotlin:kotlin-stdlib:jar:1.0.3:compile
[DEBUG]       org.jetbrains.kotlin:kotlin-runtime:jar:1.0.3:compile
[DEBUG]    org.postgresql:postgresql:jar:9.4.1211:compile
[DEBUG]    commons-dbutils:commons-dbutils:jar:1.6:compile
[DEBUG]    com.h2database:h2:jar:1.4.191:compile
[DEBUG]    junit:junit:jar:4.12:compile
[DEBUG]    com.sun.jndi:ldap:jar:1.2.4:compile
[DEBUG]    com.github.seratch:kotliquery:jar:1.1.1:compile
[DEBUG]       org.slf4j:slf4j-api:jar:1.7.21:compile
[DEBUG]       joda-time:joda-time:jar:2.9.4:compile
[DEBUG]       org.jetbrains.kotlin:kotlin-test-junit:jar:1.0.3:compile
[DEBUG]          org.jetbrains.kotlin:kotlin-test:jar:1.0.3:compile
[DEBUG]    com.zaxxer:HikariCP:jar:2.4.7:compile
[DEBUG]    org.mockito:mockito-all:jar:1.9.5:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.192 s
[INFO] Finished at: 2016-11-09T16:42:31+01:00
[INFO] Final Memory: 12M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project gs-rest-service: Could not resolve dependencies for project org.springframework:gs-rest-service:war:0.1.0: Failure to find com.sun.jndi:ldap:jar:1.2.4 in https://repo.spring.io/libs-release was cached in the local repository, resolution will not be reattempted until the update interval of spring-releases has elapsed or updates are forced -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project gs-rest-service: Could not resolve dependencies for project org.springframework:gs-rest-service:war:0.1.0: Failure to find com.sun.jndi:ldap:jar:1.2.4 in https://repo.spring.io/libs-release was cached in the local repository, resolution will not be reattempted until the update interval of spring-releases has elapsed or updates are forced
        at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221)
        at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127)
        at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:245)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project org.springframework:gs-rest-service:war:0.1.0: Failure to find com.sun.jndi:ldap:jar:1.2.4 in https://repo.spring.io/libs-release was cached in the local repository, resolution will not be reattempted until the update interval of spring-releases has elapsed or updates are forced
        at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:211)
        at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195)
        ... 23 more
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Failure to find com.sun.jndi:ldap:jar:1.2.4 in https://repo.spring.io/libs-release was cached in the local repository, resolution will not be reattempted until the update interval of spring-releases has elapsed or updates are forced
        at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:384)
        at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:205)
        ... 24 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find com.sun.jndi:ldap:jar:1.2.4 in https://repo.spring.io/libs-release was cached in the local repository, resolution will not be reattempted until the update interval of spring-releases has elapsed or updates are forced
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
        at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:367)
        ... 25 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find com.sun.jndi:ldap:jar:1.2.4 in https://repo.spring.io/libs-release was cached in the local repository, resolution will not be reattempted until the update interval of spring-releases has elapsed or updates are forced
        at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:231)
        at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:206)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:585)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:503)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
        ... 27 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Upvotes: 0

Views: 1829

Answers (1)

user207421
user207421

Reputation: 310980

I'm trying to create a project having the LDAP (specifically com.sun.jndi.ldap.LdapCtxFactory) jar.

The class you mention has been provided with the JDK and JRE since 1.4. You don't have to do anything with Maven or anything else to get it.

Upvotes: 1

Related Questions