UploadArcive to local file system

I am new to Gradle and am trying to upload a Jar to a folder on my machine. I have tried to use:

def path
= new FlatDirectoryArtifactRepository('path on machine')
 def path
= new FileDirectory('path on machine')
 def path
= new File('path on machine')
  uploadArchives {
    repositories {
       flatDir {
           dir $path
         }
    }
}

But everything I have tried fails. If I just put the path as a string in dir. I get a new directory in my project folder. How can I get access a directory on my machine??

The following should work:

uploadArchives {

repositories {

mavenDeployer {

repository(url: new File(“absolute path”).toURI().toString())

}

}

}