Download a third party jar and place it in the build directory

HI, How to download an internal jar and place it in the build directory in build.gradle.kts

this is how I did in build.gradle

configurations {
customjar
}
dependencies {
customjar(“com.test.agent:test-agent:1.0”)
}

task copyAgent(type: Copy) {
	from { configurations.customjar } into "$buildDir/libs"
}

build.dependsOn copyAgent

You need to supply the path to that jar file if you’re not using maven.

configurations {
    customjar
}

If you are in an Android setup then

dependencies {
    classpath file('path/to/your/jar/libs/folder')
}

if you are in a java project setup then:

dependencies {
    compile files('path/to/your/jar/file/1', 'path/to/your/jar/file/2'
}

or even better you can specify where to find all your libs jars in one shot like this:

dependencies {
    compile fileTree(dir: '$buildDir/libs', include: '*.jar')
}

I suggest that you don’t place your jars into build directory simply cuz a clean task would remove that folder once executed. instead you can put them under this path $projectDir/libs which would be a simple directory called libs in your root project directory.