Configured artifacts are not uploaded during uploadArchives

I can’t figure out why uploadArchives continues to try to upload a jar that doesn’t exist instead of the archive that I’ve configured in the artifacts closure. I would appreciate some suggestions.

def customPackage = tasks.custom.archive
  artifacts {
  println customPackage
  archives customPackage
}
  ['repoUser', 'repoPassword'].each { if (!project.hasProperty(it)) project.ext."$it" = '' }
  uploadArchives {
  repositories.mavenDeployer {
    uniqueVersion = false
    def credentials = [userName: project.repoUser, password: project.repoPassword]
    repository(url: "http://repo/releases/") {
      authentication(credentials)
    }
    snapshotRepository(url: "http://repo/snapshots/") {
      authentication(credentials)
    }
  }
}

This is the output

/home/connor/dev/p4/project/build/custom/project-custom-1.0.0-SNAPSHOT-fpp.tar.gz
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:uploadArchives
Uploading: com/company/project/1.0-SNAPSHOT/project-1.0-SNAPSHOT.jar to repository remote at http://repo/snapshots/
Transferring 0K from remote
  FAILURE: Build failed with an exception.
  * What went wrong:
Execution failed for task ':uploadArchives'.
> Could not publish configuration ':archives'.
   > Error deploying artifact 'com.company.project:project:jar': Error deploying artifact: Failed to transfer file: http://repo/snapshots/com/company/project/project/1.0-SNAPSHOT/project-1.0-SNAPSHOT.jar. Return code is: 401

The 401 is expected, but the attempt to upload a jar is not. Any ideas?

Thank you, Connor

Some creative Googling led me to this, which removes the jar from the list of archives. The Java plugin adds this even if you don’t need it.

configurations.archives.artifacts.removeAll { it.archiveTask.is jar }