title: How to publish an XML file to Maven repo from Gradle
body: <p>I have a static xml file that I want to publish to a Maven repository (my local Maven repo for now) from Gradle using the maven-publish plugin.</p>
  
  <p>build.gradle looks like this:</p>
  
  <pre><code>apply plugin: 'maven-publish'
  
  group 'com.example.gradletest'
  version '1.0-SNAPSHOT'
  
  publishing {
      publications {
          beta(MavenPublication) {
              artifactId 'feature-file'
              artifact 'src/main/resources/features.xml'
          }
      }
  }
  </code></pre>
  
  <p>This works, but I would like to add a classifier too, where should I define that?
  <a href="https://docs.gradle.org/current/userguide/publishing_maven.html" rel="nofollow">https://docs.gradle.org/current/userguide/publishing_maven.html</a> says in section 68.2.2 that it should be possible to do:</p>
  
  <pre><code>publishing {
      publications {
          beta(MavenPublication) {
              artifactId 'feature-file'
              artifact ('src/main/resources/features.xml') {
                  classifier 'features'
              }
          }
      }
  }
  </code></pre>
  
  <p>but then I get this error:</p>
  
  <p>A problem occurred configuring root project 'testapplication'.</p>
  
  <blockquote>
    <p>Exception thrown while executing model rule: org.gradle.api.publish.plugins.PublishingPlugin$Rules#publishing(org.gradle.api.plugins.ExtensionContainer)
    No signature of method: java.io.File.call() is applicable for argument types: (build_101arjzoe908rdkh5aikrn6bt$_run_closure5_closure16_closure19_closure20) values: [build_101arjzoe908rdkh5aikrn6bt$_run_closure5_closure16_closure19_closure20@2aa7399c]
    Possible solutions: wait(), any(), wait(long), each(groovy.lang.Closure), any(groovy.lang.Closure), list()</p>
  </blockquote>
  
  <p>Using the below solution will correctly add the classifier, but will also change the packaging in the pom.xml from <code>&lt;packaging&gt;xml&lt;/packaging&gt;</code> to <code>&lt;packaging&gt;pom&lt;/packaging&gt;</code>. I don't want that.</p>
  
  <pre><code>publishing {
      publications {
          beta(MavenPublication) {
              artifactId 'feature-file'
              artifact source: 'src/main/resources/features.xml', classifier: 'features'
          }
      }
  }
  </code></pre>