Taras Leskiv
Taras Leskiv

Reputation: 1875

Get .jar file from local maven repository

I am publishing my .jar files to the local .m2 repository. I just need to copy that jar afterwards into a custom folder.

I don't need need to add any dependency, just get a file. What is the simplest way to make a copy task of a specific .jar from local repository without hardcoding its path?

Upvotes: 0

Views: 705

Answers (1)

Josh Stark
Josh Stark

Reputation: 93

Try:

configurations { copyDeployable }

dependencies {
    copyDeployable "<group>:<artifact>:<version>@jar"
}

task copyJar(type: Copy) {

    from project.configurations.copyDeployable.singleFile
    into "/whatever/file/path/"
}

Upvotes: 1

Related Questions