CircleCi 2.0 работает с подкаталогом - PullRequest
0 голосов
/ 28 мая 2018

Я пытаюсь интегрировать свой учебный проект springboot с CircleCi.

Мой проект находится в подкаталоге внутри репозитория Github, и я получаю следующую ошибку от CircleCi.

Цель требует выполнения проекта, но в этом каталоге нет POM (/ home / circleci / recipe).Пожалуйста, убедитесь, что вы вызвали Maven из правильного каталога.

Я не могу понять, как сказать circle-ci, что мой проект находится в подкаталоге.Я попробовал несколько вещей, а также попытался "1010" внутри "рецепта", но он не работает или даже не чувствует себя хорошо.

Вот структура моего проекта:

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

Вот мой 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

Ответы [ 2 ]

0 голосов
/ 18 января 2019

Если кто-то пытается запустить команду npm и cd не работает должным образом, например, как:

cd subdir && npm run command

Вы можете использовать --prefix параметр npm.

- run:
      name: Run start command in recipe folder
      command: npm --prefix ./recipe run start

# then in same file
- run:
      name: Run test command in app folder
      command: npm --prefix ./app run test
0 голосов
/ 28 мая 2018

Мне удалось решить проблему.Я считаю, что комбинация

working_directory: ~/spring-tutorial/recipe

и

  - checkout:
      path: ~/spring-tutorial

заставила его работать.

Вот моя работа 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
...