Gradle Could not create service of type InitScriptHandler using BuildScopeServices.createInitScriptHandler()

后端 未结 22 1893
囚心锁ツ
囚心锁ツ 2020-12-05 03:39

I used gradle build command in Centos 7 terminal and I got output:

FAILURE: Build failed with an exception.

* What we         


        
22条回答
  •  攒了一身酷
    2020-12-05 04:41

    If you run Docker-in-Docker and mount the project directory from docker host directly to docker container:

    -v ${PWD}:/path_to_project -w /path_to_project

    the owners are different and docker container user (either gradle or root) can't override/delete ./buildSrc/build or ./build/

    One of the fixes - copy the sources inside the container to temporary directory and build there.

    Smth like this (first mounted to project, but then copied to project-copy to "decouple" with the host system real files and run the build in the copy):

    docker run -v "${PWD}":/home/gradle/project -w /home/gradle/project-copy \
        --rm \
        --entrypoint sh \
        gradle:5.5.1-jdk11 \
        -- -c "cp -r -T /home/gradle/project ./  &&  ./gradlew build"
    

提交回复
热议问题