CircleCi 2.0 working with project inside the subdirectory

I managed to fix the issue. I believe the combination of

    working_directory: ~/spring-tutorial/recipe

and of

  - checkout:
      path: ~/spring-tutorial

made it work.

Here is my working config.yml:

# Java Maven CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2
jobs:
  build:
    working_directory: ~/spring-tutorial/recipe
    docker:
      # specify the version you desire here
      - image: circleci/openjdk:8-jdk

      # 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

    environment:
      # Customize the JVM maximum heap limit
      MAVEN_OPTS: -Xmx3200m

    steps:
      - checkout:
          path: ~/spring-tutorial

      # Download and cache dependencies
      - restore_cache:
          keys:
          - recipe-{{ checksum "pom.xml" }}
          # fallback to using the latest cache if no exact match is found
          - recipe-

      - run: mvn dependency:go-offline

      - save_cache:
          paths:
            - ~/.m2
          key: recipe-{{ checksum "pom.xml" }}

      # run tests!
      - run: mvn integration-test

I got confused a little bit so I would like to clarify it more

the key solution for building subdirectory to define your working-space, in this case, its subfolder so it will defined like this

 working_directory: ~/repo/sub_folder

and checkout to

- checkout:
     path: ~/repo

to be like this

# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
  build:
    docker:
      # specify the version you desire here
      - image: circleci/node:7.10

      # 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/mongo:3.4.4

    working_directory: ~/repo/sub_folder

    steps:
      - checkout:
            path: ~/repo

      # Download and cache dependencies
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "package.json" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - run: npm install

      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      # run tests!
      - run: npm test