Search code examples
spring-bootmavengithubgoogle-cloud-platformbuildpack

Spring Boot/Kotlin maven project building using buildpacks fails with "./mvnw: permission denied"


I'm trying to build and deploy Spring Boot/Kotlin maven project in Google Cloud. I'm using buildpacks and my project location is GitHub. It fails with the following error:

[builder] Failure: (ID: 7d0b3ca3) executing command "./mvnw clean package --batch-mode -DskipTests -Dhttp.keepAlive=false --quiet": fork/exec ./mvnw: permission denied

More build logs:

................ Initialized empty Git repository in /workspace/.git/ From https://github.com/i-blast/photo-backend * branch
641e09a5803cdf078ab64ac47f84809dd33bbc2f -> FETCH_HEAD HEAD is now at 641e09a fix: Replace output image analysis response to std in with logger output BUILD Pulling image: gcr.io/k8s-skaffold/pack Using default tag: latest latest: Pulling from k8s-skaffold/pack Digest: sha256:410a0f8a63d42b0c5ac800ba9c71789fcbffbf4fc4691a109e2883e3a365b629 Status: Downloaded newer image for gcr.io/k8s-skaffold/pack:latest gcr.io/k8s-skaffold/pack:latest latest: Pulling from buildpacks/builder ................ Digest: sha256:ac0c5fdf12f61aada2fcf210e72c7c1bd7c99f7b685e5f5f9ad3ee318bd218df Status: Downloaded newer image for gcr.io/buildpacks/builder:latest v1: Pulling from buildpacks/gcp/run ................ Digest: sha256:e7ca52efe350a88d38050cc442bfd7013f2297affb2d37115815d7b5a3c616ad Status: Downloaded newer image for gcr.io/buildpacks/gcp/run:v1 0.13.3: Pulling from buildpacksio/lifecycle ................ Digest: sha256:9d194fc3997e8c448473431433908d932cd359b10b270f2b0f76ec795c8cae28 Status: Downloaded newer image for buildpacksio/lifecycle:0.13.3 ===> DETECTING [detector] 4 of 5 buildpacks participating [detector] google.java.runtime 0.9.1 [detector] google.java.maven 0.9.0 [detector] google.java.entrypoint 0.9.0 [detector] google.utils.label 0.0.2 ===> ANALYZING [analyzer] Previous image with name "gcr.io/photo-backend-application/github.com/i-blast/photo-backend:641e09a5803cdf078ab64ac47f84809dd33bbc2f" not found ===> RESTORING ===> BUILDING [builder] === Java - Runtime ([email protected]) === [builder] Using latest Java 11 runtime version. You can specify a different version with GOOGLE_RUNTIME_VERSION: https://github.com/GoogleCloudPlatform/buildpacks#configuration [builder] -------------------------------------------------------------------------------- [builder] Running "curl --fail --show-error --silent --location https://api.adoptopenjdk.net/v3/assets/feature_releases/11/ga?architecture=x64&heap_size=normal&image_type=jdk&jvm_impl=hotspot&os=linux&page=0&page_size=1&project=jdk&sort_order=DESC&vendor=adoptopenjdk" [builder] [builder] [ [builder] { [builder] "binaries": [ [builder] { [builder] "architecture": "x64", [builder] "download_count": 429925, [builder]
"heap_size": "normal", [builder] "image_type": "jdk", [builder] "jvm_impl": "hotspot", [builder]
"os": "linux", [builder] "package": { [builder]
"checksum": "43fb84f8063ad9bf6b6d694a67b8f64c8827552b920ec5ce794dfe5602edffe7", [builder] "checksum_link": "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.14.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.14.1_1.tar.gz.sha256.txt", [builder] "download_count": 429925, [builder]
"link": "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.14.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.14.1_1.tar.gz", [builder] "metadata_link": "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.14.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.14.1_1.tar.gz.json", [builder] "name": "OpenJDK11U-jdk_x64_linux_hotspot_11.0.14.1_1.tar.gz", [builder]
"size": 193110496 [builder] }, [builder]
"project": "jdk", [builder] "scm_ref": "jdk-11.0.14.1+1_adopt", [builder] "updated_at": "2022-02-10T12:35:32Z" [builder] } [builder] ], [builder] "download_count": 992972, [builder] "id": "MDc6UmVsZWFzZTU5MjI2NDAx.+ZQeBQqN7lfK6A==", [builder]
"release_link": "https://github.com/adoptium/temurin11-binaries/releases/tag/jdk-11.0.14.1%2B1", [builder] "release_name": "jdk-11.0.14.1+1", [builder]
"release_type": "ga", [builder] "source": { [builder]
"link": "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.14.1%2B1/OpenJDK11U-sources_11.0.14.1_1.tar.gz", [builder] "name": "OpenJDK11U-sources_11.0.14.1_1.tar.gz", [builder] "size": 123673644 [builder] }, [builder] "timestamp": "2022-02-10T12:24:13Z", [builder] "updated_at": "2022-03-07T14:41:37Z", [builder] "vendor": "eclipse", [builder] "version_data": { [builder] "build": 1, [builder] "major": 11, [builder] "minor": 0, [builder] "openjdk_version": "11.0.14.1+1", [builder]
"patch": 1, [builder] "security": 14, [builder]
"semver": "11.0.14+101" [builder] } [builder] } [builder] ]Done "curl --fail --show-error --silent --location https://api.ado..." (382.570374ms) [builder] Installing Java v11.0.14+101 [builder] -------------------------------------------------------------------------------- [builder] Running "bash -c curl --fail --show-error --silent --location --retry 3 https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.14.1%2B1/OpenJDK11U-jdk_x64_linux_hotspot_11.0.14.1_1.tar.gz | tar xz --directory /layers/google.java.runtime/java --strip-components=1" [builder] Done "bash -c curl --fail --show-error --silent --location --retry..." (4.184067234s) [builder] === Java - Maven ([email protected]) === [builder] -------------------------------------------------------------------------------- [builder] Running "./mvnw clean package --batch-mode -DskipTests -Dhttp.keepAlive=false --quiet" [builder] Done "./mvnw clean package --batch-mode -DskipTests -Dhttp.keepAli..." (860.796µs) [builder] Failure: (ID: 7d0b3ca3) executing command "./mvnw clean package --batch-mode -DskipTests -Dhttp.keepAlive=false --quiet": fork/exec ./mvnw: permission denied [builder] -------------------------------------------------------------------------------- [builder] Sorry your project couldn't be built. [builder] Our documentation explains ways to configure Buildpacks to better recognise your project: [builder] -> https://github.com/GoogleCloudPlatform/buildpacks/blob/main/README.md [builder] If you think you've found an issue, please report it: [builder] -> https://github.com/GoogleCloudPlatform/buildpacks/issues/new [builder] -------------------------------------------------------------------------------- [builder] ERROR: failed to build: exit status 1

ERROR: failed to build: executing lifecycle. This may be the result of using an untrusted builder: failed with status code: 51 ERROR ERROR: build step 0 "gcr.io/k8s-skaffold/pack" failed: step exited with non-zero status: 1


Solution

  • Thanks to khmarbaise - this solved the issue:

    git update-index --chmod=+x mvnw

    and then pushing changes to repository.