Circle ci cannot download dependencies from private repository during checkout

My pom.xml file has a dependency which is hosted in our private nexus repo. Now I am trying to run the integration tests on circleci and the circleci cannot download that dependency on checkout because of the authentication problem. I have provided the authentication details in the environment variables and here is my config.yml file

Java Maven CircleCI 2.0 configuration file

Check https://circleci.com/docs/2.0/language-java/ for more details

version: 2
jobs:
  build:
    docker:
      # specify the version you desire here
      - image: circleci/openjdk:8-jdk
      - image: circleci/postgres:12-alpine
        auth:
         username: $NEXUS_USERNAME
         password: $NEXUS_PASSWORD

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/postgres:9.4
    test:
     override:
      - mvn deploy -Prun-its -s settings.xml
    dependencies:
     override: 
      - mvn dependency:resolve -s settings.xml  
    working_directory: ~/repo
    environment:
      # Customize the JVM maximum heap limit
      MAVEN_OPTS: -Xmx3200m

    steps:
      - checkout
      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "pom.xml" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-
      - run: mvn dependency:go-offline
      - save_cache:
          paths:
            - ~/.m2
          key: v1-dependencies-{{ checksum "pom.xml" }}

      # run tests!
      - run: mvn integration-test

I get the error

ERROR] Failed to execute goal on project abc-service: Could not resolve dependencies for project abc-service:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at java-commons:jar:master-20190725.084731-2: Failed to read artifact descriptor for java-commons:jar:master-20190725.084731-2: Could not transfer artifact java-commons:pom:master-20190725.084731-2 from/to (https://nexus.abc.de/repository/abc): Not authorized -> [Help 1]

could some one tell how can I authenticate circleci?

I guess that is the issue here. I assume you can authenticate yourself to this repo in whatever way you would in a development machine. Does it use SSH keys locally?

Did you ever got to the bottom of this problem?

Have you found a resolution?

Fixed it using job with command:

- run:
          name: Test
          command: |
            mvn -s ./settings.xml clean test