Java Gradle build fails with sub-project not found

I have a Java Web application project with 3 libraries as sub-projects. These libraries are private and exist in the GitHub repository separately but they are not in maven. These libraries are added to the Web project as sub-project like this:

In settings.gradle file, I define the libraries as

include 'myLibrary'
project(':myLibrary').projectDir = file('../myLibrary')

In build.gradle file, I include this project as
compile project(":myLibrary")

We work locally on these libraries as they are not fully evolved and we do frequent changes. Now the problem is that, I created an action which builds the project when a push is made but the build fails (as expected) because the local libraries do not exist in the build environment. This is the output message:

Could not determine the dependencies of task ':war'.
  > Could not resolve all task dependencies for configuration ':runtimeClasspath'.
     > Could not resolve project :myLibrary.
     Required by:
         project :
     > No matching configuration of project :myLibrary was found. The consumer was configured 
       to find a runtime of a library compatible with Java 11, packaged as a jar, and its dependencies
       declared externally but:
           -None of the consumable configurations have attributes.

I understand the problem which perfectly makes sense but I don’t know how to solve this.