Issue adding war file in gradle 4.5 comparred to gradle 3.5

I am trying to add war file to my jar of jars, wars. Using gradle 3.5 it works. I am able to see war file inside my jar. Using gradle 4.4, I see Modules jar file instead of war. I am not sure what is causing this issue other than gradle version.
Can someone let me know if there is a way to circumvent this? I’ve posted my project structure & build.gradle file.

RootProject
|
|
|------------ Module1 (Builds jar file)
|
|------------ Module2 (Builds jar file)
|
|
|------------ Module3 (War file - WEB-INF/lib contains jar file from Module 1 & 2, Jsps, META-INF, etc)
|
|
|------------ Module4 (UberJar - Jar of Jars, War)

Module4 - build.gradle is given below:

dependencies {
  compile(project(':Module1')) {
    transitive = false
  }
  compile (project(':Module2')) {
    transitive = false
  }

  compile (project(':Module3')) {  // which is war
    transitive = false
  }

}

task copyDeps(type: Copy) {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    from(configurations.compile)
    into buildDir.path + '/lib'
}

task uberJar(type: Jar, dependsOn: [copyDeps]) { 
  into('lib') {
    from {
      configurations.runtime.collect {
        it.isDirectory() ? it : it.getAbsoluteFile()
      }
    }
  }
  into('META-INF') {
    from("./META-INF") {
      include '**/*'
    }
  }
}

When uberJar is created, I get Module3.jar and not Module3.war file.

Appreciate your response.

Thanks a lot.