Cannot resolve the SNAPSHOT dependency deployed via Maven deploy-file

Hello,

I have a problem with Nexus dependency resolution. Nexus version is 3.13.

I have a project “A” which is used as a library across different projects. I am trying to create - SNAPSHOT versions to be used for DEV environment - RELEASE versions will be used after code freeze and to deploy other environments.

I deploy the project “A” as a snapshot to a maven hosted repository(jar file, snapshot repository). I tried “deploy plugin” 3.0.0-M1 and 2.8.2 with uniqueVersion=false. But every time a timestamp is added to the artefacts in Nexus(jar and POM files). I have no issue with timestamp but I cannot resolve the project from other projects.

When I use “LATEST” as the version then the following is the response

“The POM for filename:jar:X.Y.Z-SNAPSHOT is missing, no dependency information available”. The POM and JAR is in the repository, but the POM file contains the timestamp suffix as well.

I don’t have any problems with release repository for the same project.

Any idea?

The uniqueVersion=false flag does not work with Maven 3 (this is intentional). You’ll always get timestamped versions via Maven snapshot deploy. Make sure your settings.xml file is configured to use a nexus group repository, that the group repository contains the hosted snapshot repository, and that snapshots are enabled in the settings.xml file:

https://help.sonatype.com/display/NXRM3/Maven+Repositories#MavenRepositories-ConfiguringApacheMaven

I tried uniqueVersion=false flag for maven-deploy plugin 2.7 just to give it a try.

I tried all the steps in the link already. I can see my SNAPSHOTS in the Nexus and they are already added in maven-public which is a group and contains the necessary members.

I tried to use both maven deploy and nexus-staging-maven-plugin. The result is the same. I can see the artefacts in Nexus but cannot reference them with their version. One note is that when I try the following I got a response like

“The POM for my-libraryl:jar:20181003-9450157-SNAPSHOT is missing, no dependency information available”. There is a POM but it is already suffixed with timestamp.

<dependency>
<groupId>some groupIDs</groupId>
<artifactId>my-library</artifactId>
<version>LATEST</version>

</dependency>

Don’t use LATEST as a version. Use the snapshot base version, e.g. 1.2.3-SNAPSHOT. Also make sure snapshots are enabled in the settings.xml repository definitions:

      <repositories>
    <repository>
      <id>central</id>
      <url>http://central</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </repository>
  </repositories>
 <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <url>http://central</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
  </pluginRepositories>

This is the part from settings.xml. It is exactly as you posted.

<profile>
  <repositories>
    <repository>
      <id>central</id>
      <url>http://central</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

This is how it looks after deploy in Nexus

When I try to get the dependency in another project, the result is “Could not find artifact”. I don’t have any problem with “Releases”, only problem is SNAPSHOTs.

<dependency>
<groupId>my group ID</groupId>
<artifactId>scs-beschluss-datamodel</artifactId>
<version>0.0.30-SNAPSHOT</version>

</dependency>

Maven will cache previous download failures for 24 hours. Try adding the “-U” flag to force it to update this local cache. If this does not work pay particular attention to the URL’s maven is asking for the files from, make sure they look correct.

I forced it as well with -U, didn’t work. The URLs are correct at the end , I can get the dependencies in “Release” repositories.

I found the issue and it is related to the settings.xml. Inside the profile tag, I added another element called “id”.

<profiles>
    <profile>
         <id>nexus</id>
         .....

I am getting same error, if I downgrade the version this is working

1 Like

I’m having the same problem with a vanilla installation of Nexus OSS 3.29.2-02, I’m getting a file not found (404) when trying to get http://myserver:8081/repository/maven-public/com/mycompany/mylibrary/XX.SNAPSHOT/mylibrary-XX.SNAPSHOT.pom