GoogleCloudPlatform/buildpacks

Google build pack issue with Monorepo Gradle builder

skagithala-clgx opened this issue · 2 comments

Hi Team,

We have use case where Mono repo is configured and it is using gradle with packeto build pack and it is using common folder for dependencies resolutions.
Issue:
It is not able to find common folder and unable to build the docker image
below are the configurations
settings.gradle
rootProject.name = 'xyz'
include 'project1'
include 'project2'
where project2 is common project.
In build.gradle of project1 below line is mentioned for dependency
implementation project (path: ':project2', configuration: 'default')

Project structure:
project1
project2
gradlew
gradlew.bat
settings.gradle

Could you please guide on mono repo configuration, provide if we have any documentation for the same.
Attached the build logs
build log.txt

Hey @skagithala-clgx are you using the Paketo buildpacks or the GCP buildpacks? For monorepo configurations, you'll usually want to take advantage of the GOOGLE_BUILDABLE environment variable to target the project folder where your app is.

Assuming you're running pack build from the top level of your project, you'll want to do something like:

pack build project2  \
       --env "GOOGLE_BUILDABLE=./project2" \
       --builder gcr.io/buildpacks/builder:google-22 \
       --path .

I think minimal change here would be to have the gradle buildpack opt-in when we see a settings.gradle in the root