title: How to pull artifacts from Artifactory to project classpath using gradle?
body: <p>I'm new to gradle and Artifactory integration and so far I can publish artifacts from one workspace to another. </p>
  
  <p>What I did was created a gradle sample project and now I would like to publish i.e. JUnit jar into Artifactory and then retrieve it to my project classpath as a dependency, so that I can run my project. </p>
  
  <h2>Project strructure</h2>
  
  <p><img src="https://i.stack.imgur.com/d9cHE.png" alt="enter image description here"></p>
  
  <h2>build.gradle</h2>
  
  <pre><code>apply plugin: 'java'
     apply plugin: 'eclipse'
     //apply plugin: 'artifactory-publish'
     sourceCompatibility = 1.5
     version = '1.0'
  
  jar 
  {
      manifest 
       {
          attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation Version': version
      }
  }
  
  buildscript 
  {
      repositories 
      {
          maven 
          {
              url 'http://dl.bintray.com/jfrog/jfrog-jars' 
          }
          mavenCentral()
      }
      dependencies 
      {
          classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.1.0')
      }
  }
  
  //pull/retrieve artifacts(jar) from artifactory
  repositories 
  {
      ivy 
      {
          url = 'http://localhost:8081/artifactory/APM-jars'
           credentials
          {
              username = 'admin'
              password = 'password'
          }
      }
      mavenCentral()
  
  dependencies {
       compile group: 'jakarta-regexp', name: 'jakarta-regexp', version: '1.+'
      compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
      testCompile group: 'junit', name: 'junit', version: '4.+'
  }
  }
   test {
      systemProperties 'property': 'value'
  }
  
  ///publish/upload artifact (jar) into 3 different type of builds
  uploadArchives 
  {
      repositories 
      {
          //Just copy to a directory
      //flatDir 
          //{
              //dirs 'repos2'
          //}
  
  
          //Publish to an Ivy repository in Artifactory.
          ivy 
          {    
              url = 'http://localhost:8081/artifactory/test-ivy'
              credentials 
              {
                  username = 'admin'
                  password = 'password'
              }
          }
      //Publish to a Gradle repository in Artifactory.
      ivy 
      {
          url = 'http://localhost:8081/artifactory/test-gradle'
          credentials 
          {
              username = 'admin'
              password = 'password'
          }
          //layout 'gradle'
          layout 'pattern', 
          {
              artifact '[module]/[revision]/[artifact](.[ext])'
              ivy '[module]/[revision]/ivy.xml'
          }
         }
          //Publish to a Maven repository in Artifactory.
          ivy 
          {
              url = 'http://[host]:port/artifactory/test-maven'
              credentials 
          {
                  username = 'admin'
                  password = 'password'
              }
              layout 'maven'
          }
      }
  }
  </code></pre>