0

I have Nexus OSS 3.29 installed on the local network and I am able to start it (http://somehost:8081/ ) and browse it. 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 ( RunAs->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 feel like I am missing some configuration settings, not sure what it is. I also tried to add repository definition to my "pom.xml" and it didn't work.

vs777
  • 564
  • 2
  • 11
  • 24
  • First I would suggest to put this configuration to consume from your repository manager only into the `settings.xml` and not in the `pom.xml`. Furthermore you can not find the given artifact because it does not exist with those coordinates and version...where I suppose the right coordinates are the following: https://search.maven.org/artifact/org.apache.commons/commons-lang3/3.12.0/jar – khmarbaise Jul 19 '21 at 15:49
  • 1
    Thank you. I solved this issue by using correct repo URL : http://somehost:8081/repository/ – vs777 Jul 20 '21 at 20:31

1 Answers1

0

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.

vs777
  • 564
  • 2
  • 11
  • 24
  • What you have done is manually download "org.apache.commons:commons-lang3" from Central and uploaded it locally as "commons-lang:commons-lang", thereby breaking any relationship btwn the two. This is not good. Only you know this. What if there's a CWE (vulnerability) or ver. update, or even another jar declares it as dependency? Set up a proxy to Central in Nexus and use the real GAV. – Ian W Sep 25 '21 at 06:41