Including Google Maps API Library in EAR File?

I’m using GitHub - googlemaps/google-maps-services-java: Java client library for Google Maps API Web Services in an app which has a WAR file contained in an EAR file deployed to a web server. Following the readme, I added:

repositories {
mavenCentral()
}

dependencies {
implementation ‘com.google.maps:google-maps-services:(insert latest version)’
implementation ‘org.slf4j:slf4j-simple:1.7.25’
}

to build.gradle for my WAR. This builds successfully and I can see the library included in my Eclipse environment. However, when I build the EAR and deploy it, I see:

java.lang.NoClassDefFoundError: com.google.maps.GeoApiContext$Builder

indicating to me that the dependency isn’t being included in the EAR. Presumably, I need to edit build.gradle for the EAR, but it’s not clear to me how to do this. Copying the same edits from the WAR build file causes the compilation to fail:

Could not find method implementation() for arguments [com.google.maps:google-maps-services:0.10.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Could anyone explain to me how to tell Gradle to include this library in the EAR?