Problem with nexus and artifacts

Hello, I have a pipeline which run a Java Spring boot project,
My project is modular and i build even module in a single stage, and i pass the artifact to the next stage so he can build.
The problem is the 2nd stage ignore the artifact and pull the dependencies from nexus repository which is had a old version of my code
I want the stage use the artifact that i passed it from the previous stage not the nexus dependencies

This may not be helpful for your instance, but I was having a problem getting my dependencies to load in a node project I am working on. I ended up creating a stage in my pipeline to load the updated dependencies into a cache, and then when the next stage and the stage after run, it loads the dependcies from cache.
Here is what I’m doing in my .gitlab-ci.yml.

stages:
  - install_dependencies
  - build
  - deploy

dependencies:
  stage: install_dependencies
  cache:
    key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
    paths:
      - node_modules/
  script:
    - npm ci
  only:
    changes:
      - package-lock.json

build:
  stage: build
  tags:
    - Build PWA
  cache:
    key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
    paths:
      - node_modules/
    policy: pull
  script:
    - echo "Building Deploy Package"
    - ls -alh
    - npm run build
    - echo "Build successful"
  artifacts:
    paths:
      - .next/
  only:
    - master


deploy_staging:
  stage: deploy
  tags:
    - Deploy Staging
  cache:
    key: $CI_COMMIT_REF_SLUG-$CI_PROJECT_DIR
    paths:
      - node_modules/
    policy: pull

  script:
    - echo "Deploying to server"
    - rsync -a --delete ../fubar /home/root1/example/
    - echo "Deployed"
  environment:
    name: staging
    url: /redacted/
  only:
    - master

@Medharoun , are you using maven or gradle? (I know you have a maven tag, but gradle uses maven repositories too)

Also, which GitLab runner are you using? (ie: are you using gitlab.com, or something else?)

To investigate, I’d add some debugging code to print out what exists in the artifact dirs at the beginning and end of each stage (eg: find my_artifact_dir -type f -print) to confirm that the files are being created and being migrated as you expect they should. Also, verify that that’s really the place your build system (maven or gradle) will go looking for them, and that it doesn’t require some other files to exist.

@xenomachina , I’m using maven and for gitlab runner i’m using a runner on kubernate.

also i’m sure that my stage download the artifact i saw it in log which is the right artifact with the recent modification

hI MAD
I just read your descriptions and understand your need let me know if you facing that problem still I can help you definitely

Hi
I solve the problem by swap the job of nexus deploy of 1er module before i run the job of build of the 2nd module.
It takes much time but it solve the problem