Mvn: command not found ... but it manually works when connected via ssh to the container

Dear everybody,
I’m trying to switch to circle 2.0 to build a java application with maven. I’ve followed all the instruction found in the migration guide and I’ve looked at the example project (https://github.com/CircleCI-Public/circleci-demo-java-spring/blob/master/.circleci/config.yml).

Here my configuration yaml file:

version: 2

jobs:
  build:
    working_directory: ~/entity-cooking
    parallelism: 1
    shell: /bin/bash --login

    environment:
      CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
      CIRCLE_TEST_REPORTS: /tmp/circleci-test-results

    docker:
     - image: circleci/openjdk:8-jdk-browsers

    steps:
      - checkout
#      - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
      - run: mvn package
      - store_test_results: # uploads the test metadata from the `target/surefire-reports` directory so that it can show up in the CircleCI dashboard.
          path: target/surefire-reports

I have two issues:

  1. the mkdir command doesn’t work. afaik it should read the env variable declared above.
  2. most critical, I get an error mvn: command not found (see example: https://circleci.com/gh/kermitt2/entity-cooking/176) however I was able to connect via ssh and complete the build manually.

Any hint is appreciated.

Thank you
Luca

OK so I’ve solved it right after have written this post…

  1. to solve the issue with the environment variable I’ve moved the ‘environment’ under the docker image.
  2. to solve the issue with maven I have removed --login from the shell: command.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.