Wrong version when publishing Gradle project

I have a multi-module Gradle project:

  |_ ProjectA
        |_ SubModuleA.1
        |_ SubModuleA.2
        |_ gradle.properties
        |_ build.gradle
  |_ ProjectB
        |_ gradle.properties
        |_ build.gradle
  |_ gradle.properties
  |_ build.gradle
  |_ settings.gradle

I have a different version specified in the gradle.properties files of (1) the root project, (2) Project A, (3) Project B.

For example, in root project#gradle.properties:


And in Project A#gradle.properties:


However, when I try to ./gradlew clean publish on Project A, my submoduleA.1’s jar has the version 0.0.0 when I expect it to be What is wrong here? Shouldn’t the gradle.properties file be overridden further down the file structure hierarchy (i.e. using Project A’s properties instead of the root properties)?

P.S. I am using the maven-publish plugin as well, if that affects anything.

Project specific gradle.properties files are only read from the root project directory.