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

**URL:** <https://discuss.gradle.org/t/deploying-multiple-artifacts-war-jar-sources-to-artifactory/4239>\
**Category:** Old Forum Archive\
**Created:** [January 28, 2015, 10:50pm UTC](https://discuss.gradle.org/t/deploying-multiple-artifacts-war-jar-sources-to-artifactory/4239 "2015-01-28T22:50:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jolcese](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/jolcese/32/845_2.png) [@jolcese](https://discuss.gradle.org/u/jolcese)\
**Post date:** [January 28, 2015, 10:50pm UTC](https://discuss.gradle.org/t/deploying-multiple-artifacts-war-jar-sources-to-artifactory/4239/1 "2015-01-28T22:50:00Z")

</div>

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:

```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:

```gradle
task packageJarApp(type: Jar) {
}
  artifacts.archives packageJarApp

```

gradlew artifactoryPublish fails with:

```gradle
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

```

---

<div class="post-metadata">

**Author:** ![Mark\_Viera](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/mark_viera/32/1543_2.png) [@Mark\_Viera](https://discuss.gradle.org/u/Mark_Viera)\
**Post date:** [January 29, 2015, 2:28am UTC](https://discuss.gradle.org/t/deploying-multiple-artifacts-war-jar-sources-to-artifactory/4239/2 "2015-01-29T02:28:00Z")

</div>

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.
