Maven Nexus can't find a dependency

1k Views Asked by At

I have Nexus OSS 3.29 installed on the local network and I am able to start and browse http://somehost:8081/. I uploaded commons-lang-3.1.jar to maven-releases and I can see it there. I have a Maven project in Eclipse where I defined a dependency:

<dependency>
  <groupId>commons-lang</groupId>
  <artifactId>commons-lang</artifactId>
  <version>3.1</version>
</dependency>

In my settings.xml, I have repository defined:

<profiles>
    <profile>
      <id>java-net-public</id>
      <repositories>
        <repository>
          <id>java-net-public</id>
          <name>Java Net Public</name>
          <url>http://somehost:8081/maven-releases/</url>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
          </snapshots>
        </repository>
      </repositories>
....
</profile>
.....
</profiles>

When I build my Project Run As -> Maven Install with -e option, I am getting an error:

Could not find artifact commons-lang:commons-lang:jar:3.1 in java-net-public (http://somehost:8081/maven-releases/).

I tried to add repository definition to my pom.xml and it didn't work.

1

There are 1 best solutions below

1
vs777 On

Apparently when using Nexus as repository the URL should look like that :

http://somehost:8081/repository/

As soon as I added "repository" to the URL Maven dependencies got resolved.