Gradle 3.4 problem with jar manifest

I’ve been using the following code in several projects to build a jar file:

apply plugin: 'application'

def mainClass = 'cmb.servernexus.ServerNexusMain'

 * Tell Application plugin our main
mainClassName = "$mainClass"

dependencies {
	compile project(":CaBridge")
	compile project(":WebApp")

jar {
	manifest {
			"Implementation-Version": version,
			"Main-Class": "$mainClass",
			// Add Class-Path to manifest
			"Class-Path": configurations.compile.collect { it.getName() }.join(' '))

This works fine in Gradle version up to and including 3.2. However, in 3.4 I get:

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\mcooper\.....\build.gradle' line: 30

What went wrong:
A problem occurred evaluating project ':ServerNexus'.
 Could not resolve all dependencies for configuration ':ServerNexus:compile'.
  A problem occurred configuring project ':WebApp'.
  Resolving configuration 'apiElements' directly is not allowed

Line 30 corresponds to the “Class-Path” line build.gradle shown above.