Maven - Not finding LDAP jar file
<p>I'm trying to create a project having the LDAP (specifically <code>com.sun.jndi.ldap.LdapCtxFactory</code>) jar.</p>

<p>Now Mavencentral provides the <a href="https://mvnrepository.com/artifact/com.sun.jndi/ldap/1.2.4" rel="nofollow noreferrer">com.sun.jndi:ldap:1.2.4</a> option, showing the following code for the dependency: </p>

<pre><code>&lt;!-- https://mvnrepository.com/artifact/com.sun.jndi/ldap --&gt;
&lt;dependency&gt;
    &lt;groupId&gt;com.sun.jndi&lt;/groupId&gt;
    &lt;artifactId&gt;ldap&lt;/artifactId&gt;
    &lt;version&gt;1.2.4&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>

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

<p>My <code>&lt;repositories&gt;</code></p>

<pre><code>&lt;repositories&gt;
        &lt;repository&gt;
            &lt;id&gt;spring-releases&lt;/id&gt;
            &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
        &lt;/repository&gt;
        &lt;repository&gt;
            &lt;id&gt;mvnrepository&lt;/id&gt;
            &lt;url&gt;http://mvnrepository.com/artifact/&lt;/url&gt;
        &lt;/repository&gt;
    &lt;/repositories&gt;
    &lt;pluginRepositories&gt;
        &lt;pluginRepository&gt;
            &lt;id&gt;spring-releases&lt;/id&gt;
            &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
        &lt;/pluginRepository&gt;
    &lt;/pluginRepositories&gt;
</code></pre>

<p>On hovering the dependency tag it shows: 'Cannot find artifact ...'</p>

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

<p>Error log:</p>

<pre><code>[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 -&gt; [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
</code></pre>