Upload artifact file named differently from artifactId

I would like my build to produce a file named foo.jar but would like to upload it to nexus/maven using the maven coordinates mygroup:bar:1.0.0. What I want is for the file name to stay as foo.jar when I see it in my filesystem after a resolve even though its coordinates are mygroup:bar:1.0.0.

I’ve tried setting uploadTask.repositories.mavenDeployer.pom.artifactId to foo but that just causes the coordinates to be mygroup:foo:1.0.0. Some quick googling suggests maven might let you do this natively using the finalName element in the build section. I tried getting at the MavenProject build property via project.install.repositories.mavenInstaller.pom.model.build but that is null. Trying to construct a new Build instance gave me ClassNotFound exceptions. So I am wondering if that is even the correct approach at all.

Is this even possible? Thanks in advance for any hints!