Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CircleCi 2.0 working with project inside the subdirectory

I am trying to integrate my springboot tutorial project with CircleCi.

My project is inside a subdirectory inside a Github repository and I get the following error from CircleCi.

Goal requires a project to execute but there is no POM in this directory (/home/circleci/recipe). Please verify you invoked Maven from the correct directory.

I can't figure out how to tell circle-ci my project is inside a subdirectory. I have tried a couple of things, as well as trying to cd inside 'recipe' but it does not work or even feel right.

Here is the structure of my project:

Spring-tutorials  |  +-- projectA  |      +-- recipe  |   | +--pom.xml 

Here is my 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:     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      working_directory: ~/recipe      environment:       # Customize the JVM maximum heap limit       MAVEN_OPTS: -Xmx3200m      steps:       - checkout       - run: cd recipe/; ls -la; pwd;        # 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: cd recipe; mvn dependency:go-offline        - save_cache:           paths:             - ~/recipe/.m2           key: recipe-{{ checksum "pom.xml" }}        # run tests!       - run: mvn integration-test 
like image 553
Kevin Amiranoff Avatar asked May 28 '18 16:05

Kevin Amiranoff


1 Answers

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 
like image 118
Kevin Amiranoff Avatar answered Sep 26 '22 13:09

Kevin Amiranoff