version: 2
jobs:
  build:
    docker:
      - image: circleci/openjdk:8-jdk

    working_directory: ~/repo

    steps:
      - checkout

      - run:
          name: Build war file
          command: mvn clean package

      - deploy:
          name: Deploy to server
          command: |
            scp -P $SSH_PORT $CIRCLE_WORKING_DIRECTORY/target/courses.war $SSH_USER@$SSH_HOST:/home/$SSH_USER

#workflows:
#  version: 2
#
#  build_only_master:
#    jobs:
#      - build:
#          filters:
#            branches:
#              ignore: /.*/
#            tags:
#              only: /^\d+\.\d+\.\d+$/

version: 2
jobs:
  build:
    docker:
      - image: circleci/openjdk:8-jdk

    working_directory: ~/repo

    steps:
      - checkout

      - run:
          name: Build war file
          command: mvn clean package

      - add_ssh_keys:
          fingerprints:
            - "69:c9:8f:8d:69:8a:f3:20:ef:65:14:59:6a:0c:c5:f1"

      - deploy:
          name: Deploy to server
          command: |
            scp -P $SSH_PORT $CIRCLE_WORKING_DIRECTORY/target/courses.war $SSH_USER@$SSH_HOST:/home/$SSH_USER

#workflows:
#  version: 2
#
#  build_only_master:
#    jobs:
#      - build:
#          filters:
#            branches:
#              ignore: /.*/
#            tags:
#              only: /^\d+\.\d+\.\d+$/

Add SSH key to container
Add SSH key to container
