javagradlecircleci-2.0circleci-workflowscircleci-orb

CircleCI cannot find gradle. Error: ./gradlew: No such file or directory


I am working on a project that is developed with Java & Gradle. I want to make it work with CircleCi. I am using the simple CircleCi configuration:

version: 2.1

orbs: 
  gradle: circleci/gradle@2.2.0

workflows:
  checkout-build-test:
    jobs:
      - gradle/test

However, whenever I push the code, I am getting the following error: ./gradlew: No such file or directory

The thing is that the root folder of Gradle is not the same as CircleCi. All the java code is stored in a sub folder and not in the main folder. Usually, the source code and the CircleCi folders are stored at the same folder's level. How can I configure CircleCi to run Gradle from a different folder which is not the main?


Solution

  • I found the solution to this problem. which is:

    version: 2.1
    
    orbs: 
      gradle: circleci/gradle@2.2.0
    
    workflows:
      checkout-build-test:
        jobs:
          - gradle/test:
              app_src_directory: some/folder