Getting all files of an artifact from maven repository

1.7k views Asked by At

Our organization works in an isolated network so when we want to use libraries we need to retrieve them from maven-central and upload then to our own maven repository.

I am searching for way do download all the files of my required dependencies, I have used gradle gradle eclipseClasspath to do this but it is not downloading all the files. for example org.jacoco:jacoco:0.7.8 contains a zip file and when I look in the GRADLE_USER_HOME I can not find the zip.

build.gradle:

apply plugin: 'java'
apply plugin: 'eclipse'
repositories {
    mavenCentral()
}
dependencies {
    compile 'org.jacoco:jacoco:0.7.8'
}

What should I do?

2

There are 2 answers

0
Ido Sorozon On BEST ANSWER

I wanted a simple solution, for now I have made this ugly one https://github.com/idosu/scripts/blob/master/gradle/full-download-from-central.gradle

usage:

apply from: 'https://raw.githubusercontent.com/idosu/scripts/master/gradle/full-download-from-central.gradle'
dependencies {
    compile 'org.jacoco:jacoco:0.7.8'
}

windows: set GRADLE_USER_HOME=deps & gradle --no-daemon -b eclipseClasspath createRepo

shell: export GRADLE_USER_HOME=deps; gradle --no-daemon -b eclipseClasspath createRepo

The result will be in build/repo


A better way to do this is figuring out how eclipseClasspath resolves all the dependencies with all the parent poms. because using project.configurations.compile.resolvedConfiguration.lenientConfiguration.allModuleDependencies does not do the trick

2
lance-java On

You could use this gradle task to download the dependencies to a local directory.