anchor.diff:  
   Generated POMs can be found in `&lt;buildDir&gt;/poms`. They can be further customized via the link:{javadocPath}/org/gradle/api/artifacts/maven/MavenPom.html[MavenPom] API. For example, you might want the artifact deployed to the Maven repository to have a different version or name than the artifact generated by Gradle. To customize these you can do:
   
  -=== Example: Customization of pom
  -
  -[source.multi-language-sample,groovy]
  -.build.gradle
  -----
  -include::{samplesPath}/userguide/artifacts/maven/build.gradle[tag=customize-pom]
  -----
  +.Customization of pom
  +====
  +include::sample[dir="userguide/artifacts/maven",files="build.gradle[tags=customize-pom]"]
  +====
   
   To add additional content to the POM, the `pom.project` builder can be used. With this builder, any element listed in the http://maven.apache.org/pom.html[Maven POM reference] can be added.
   
  -=== Example: Builder style customization of pom
  -
  -[source.multi-language-sample,groovy]
  -.build.gradle
  -----
  -include::{samplesPath}/userguide/artifacts/maven/build.gradle[tag=builder]
  -----
  +.Builder style customization of pom
  +====
  +include::sample[dir="userguide/artifacts/maven",files="build.gradle[tags=builder]"]
  +====
   
   Note: `groupId`, `artifactId`, `version`, and `packaging` should always be set directly on the `pom` object.
   
  -=== Example: Modifying auto-generated content
  -
  -[source.multi-language-sample,groovy]
  -.build.gradle
  -----
  -include::{samplesPath}/maven/pomGeneration/build.gradle[tag=when-configured]
  -----
  +.Modifying auto-generated content
  +====
  +include::sample[dir="maven/pomGeneration",files="build.gradle[tags=when-configured]"]
  +====
   
   If you have more than one artifact to publish, things work a little bit differently. See <<#sub:multiple_artifacts_per_project,Multiple artifacts per project>>.
   
   To customize the settings for the Maven installer (see <<#sub:installing_to_the_local_repository,Installing to the local repository>>), you can do:
   
  -=== Example: Customization of Maven installer
  -
  -[source.multi-language-sample,groovy]
  -.build.gradle
  -----
  -include::{samplesPath}/userguide/artifacts/maven/build.gradle[tag=customize-installer]
  -----
  +.Customization of Maven installer
  +====
  +include::sample[dir="userguide/artifacts/maven",files="build.gradle[tags=customize-installer]"]
  +====
   
   
   [[sub:multiple_artifacts_per_project]]
  
positive.code: 
  Let's assume your project produces just the default jar file. Now you want to deploy this jar file to a remote Maven repository.
  
  === Example: Upload of file to remote Maven repository
  
  [source.multi-language-sample,groovy]
  .build.gradle
  ----
  include::{samplesPath}/userguide/artifacts/maven/build.gradle[tag=upload-file]
  ----
  
  That is all. Calling the `uploadArchives` task will generate the POM and deploys the artifact and the POM to the specified repository.
  
  There is more work to do if you need support for protocols other than `file`. In this case the native Maven code we delegate to needs additional libraries. Which libraries are needed depends on what protocol you plan to use. The available protocols and the corresponding libraries are listed in <<#wagonLibs,Protocol JARs for Maven deployment>> (those libraries have transitive dependencies which have transitive dependencies).footnote:[It is planned for a future release to provide out-of-the-box support for this] For example, to use the ssh protocol you can do:
  
  === Example: Upload of file via SSH
  
  [source.multi-language-sample,groovy]
  .build.gradle
  ----
  include::{samplesPath}/userguide/artifacts/maven/build.gradle[tag=upload-with-ssh]
  ----
  
  There are many configuration options for the Maven deployer. The configuration is done via a Groovy builder. All the elements of this tree are Java beans. To configure the simple attributes you pass a map to the bean elements. To add bean elements to its parent, you use a closure. In the example above _repository_ and _authentication_ are such bean elements. <<#deployerConfig,Configuration elements of Maven deployer>> lists the available bean elements and a link to the Javadoc of the corresponding class. In the Javadoc you can see the possible attributes you can set for a particular element.
  
  
negative.code: 
  Maven can only deal with one artifact per project. This is reflected in the structure of the Maven POM. We think there are many situations where it makes sense to have more than one artifact per project. In such a case you need to generate multiple POMs. In such a case you have to explicitly declare each artifact you want to publish to a Maven repository. The link:{javadocPath}/org/gradle/api/artifacts/maven/MavenDeployer.html[MavenDeployer] and the MavenInstaller both provide an API for this:
  
  .Generation of multiple poms
  ====
  include::sample[dir="userguide/artifacts/maven",files="build.gradle[tags=multiple-poms]"]
  ====
  
  You need to declare a filter for each artifact you want to publish. This filter defines a boolean expression for which Gradle artifact it accepts. Each filter has a POM associated with it which you can configure. To learn more about this have a look at link:{javadocPath}/org/gradle/api/artifacts/maven/PomFilterContainer.html[PomFilterContainer] and its associated classes.
  
  