Import build.gradle in another.gradle file


I have two files

  1. build.gradle
  2. frontend.gradle

When i execute gradle -b frontend.gradle, I wish to execute build.gradle and frontend.gradle. Basically I would like to include build.gradle in frontend.gradle.

It’s as simple as the following

in frontend.gradle:

apply from: ‘build.gradle’
// rest of your script

1 Like

Hi Francois,
When i try to run gradle -b frontend.gradle clean build, It is failing with the exception saying shared project could not be found

compile project(':shared')

Could you please let me know how to fix this?.

The same is working fine when i execute build.gradle directly.

Similar problem is described at Multi-project custom build

Well, we need more info to go on.
Like your project structure, content of build.gradle and front-end.gradle

1 Like