Deploying multiple artifacts (War, Jar & sources) to artifactory

Hi, I’m a completely newbie to Gradle and I’m trying to upload both War, Jar & Sources to artifactory. War & sources are OK with the following build.gradle:

apply plugin: 'war'
  task packageSources(type: Jar) {
  classifier = 'sources'
  from sourceSets.main.allSource
  task packageWarApp(type: War) {
  artifacts.archives packageSources
artifacts.archives packageWarApp
  apply plugin: 'artifactory'
  artifactory {
  publish {
    contextUrl = "https://myrepo/artifactory"
    repository {
      repoKey = 'libs-local'
      username = 'user'
      password = 'pass'
      maven = true

The problem arises when I add the following:

task packageJarApp(type: Jar) {
  artifacts.archives packageJarApp

gradlew artifactoryPublish fails with:

FAILURE: Build failed with an exception.
  * What went wrong:
Execution failed for task ':install'.
> Could not publish configuration 'archives'
   > A POM can not have multiple main artifacts. Already have MavenArtifact myapp:war:war:null, trying to add MavenArtifact myapp:jar:jar:null

A Maven module can only have a single “main” artifact. That is, an artifact without a classifier. You’ll have to add a classifier to your ‘Jar’ task.