title: Upload artifact to Artifactory using Gradle
body: <p>I am a newbie to Gradle and Artifactory and I want to upload a JAR file to Artifactory.</p>
  <p>Here is my <code>build.gradle</code> file:</p>
  <pre><code>apply plugin: 'java'
  apply plugin: 'eclipse'
  apply plugin: 'maven'
  apply plugin: 'artifactory-publish'
  
  groupId = 'myGroup'
  version = '1.0'
  def artifactId = projectDir.name
  def versionNumber = version
  
  artifactory {
      contextUrl = 'http://path.to.artifactory' // base artifactory url
      publish {
          repository {
              repoKey = 'libs-releases'   // Artifactory repository key to publish to
              username = 'publisher'      // publisher user name
              password = '********'       // publisher password
              maven = true
          }
      }
  }
      
  artifactoryPublish { 
      dependsOn jar
  }
  </code></pre>
  <p>After running the <code>artifactoryPublish</code> task, the build is successful as shown below:</p>
  <pre class="lang-sh prettyprint-override"><code>&gt; gradle artifactoryPublish  --stacktrace
  :compileJava UP-TO-DATE
  :processResources UP-TO-DATE
  :classes UP-TO-DATE
  :jar
  :artifactoryPublish
  Deploying build info to: http://path.to.artifactory/api/build
      
  BUILD SUCCESSFUL
      
  Total time: 7.387 secs
  </code></pre>
  <p>However, there is nothing sent to Artifactory except the build info.</p>
  <p>Any help will be much appreciated.</p>
  <p><strong>Edit:</strong></p>
  <p>As JBaruch mentioned, I've added the following:</p>
  <pre><code>apply plugin: 'maven-publish'
  
  publishing {
      publications {
          mavenJava(MavenPublication) {
              from components.java
          }
      }
  }
  </code></pre>
  <p>and defaults section to artifactory task:</p>
  <pre><code>defaults {
     publications ('mavenJava')
  }
  </code></pre>
  <p>Now it works.</p>
  <p>Thanks.</p>