Domanda

How can I fix the missing artifact error in maven with the com.sun.jndi.ldap? I also tried to add the java repositories because of the strange binary licensing. This is my pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>ActiveDirectory</groupId>
  <artifactId>my.activedirectory</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>my.activedirectory</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <repositories>
    <repository>
      <id>java.net</id>
      <url>http://download.java.net/maven/2/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>java.net</id>
      <url>http://download.java.net/maven/2/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>net.java.dev.swing-layout</groupId>
      <artifactId>swing-layout</artifactId>
      <version>1.0.2</version>
    </dependency>
    <dependency>
      <groupId>com.sun.jndi</groupId>
      <artifactId>ldap</artifactId>
      <version>1.2.4</version>
    </dependency>
  </dependencies>
</project>

Can anybody help me with this issue?

È stato utile?

Soluzione

Missing artifact exception occurs where the jar which you are looking for is not found in the repository where you have pointed to. I am afraid this jar or its latest version that you refer to is not available in the http://download.java.net/maven/2 repo.

Try jBoss repository or mavens central repo

<repository>
  <id>jboss-maven2</id>
  <name>JBoss Repository</name>
  <url>http://repository.jboss.com/maven2</url>
</repository>

or

<repository>
  <snapshots>
    <enabled>false</enabled>
  </snapshots>
  <id>central</id>
  <name>Maven Repository Switchboard</name>
  <url>http://repo1.maven.org/maven2</url>
</repository>

Altri suggerimenti

I had the similar situation in looking up for Jndi jar using Maven. Maven Central repo does not have this jar anymore.

You can download these jars from Oracle Archive @http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-java-plat-419418.html

and then install it into your local repository. This will solve the problem.

mvn install:install-file -DgroupId=javax.naming -DartifactId=jndi -Dversion=1.2.1 -Dpackaging=jar -Dfile=jndi-1_2_1.jar
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top