How to Convert Gradle build to 100% offline only?

Hi,

I have an existing build.gradle file that accesses the internet to do its work.

What general steps would I follow to convert the build to be 100% offline please?

I’m assuming I need to download all the plugins etc then create local repositories.

Any help appreciated.

Existing gradle.build file :

buildscript {
repositories {
maven {
url offlineRepositoryRoot
}
jcenter()
maven {url ‘Index of /maven2’}
maven {url “https://plugins.gradle.org/m2/
}
}
dependencies {
classpath “com.marklogic:marklogic-unit-test-client:0.12.0”
classpath “net.saliman:gradle-properties-plugin:1.4.6”
classpath “gradle.plugin.com.marklogic:ml-data-hub:4.3.2”
classpath “gradle.plugin.io.pry.gradle.offline_dependencies:gradle-offline-dependencies-plugin:0.5.0”
}
}

plugins {
id ‘java’
id ‘eclipse’
id ‘idea’

//offline access
id 'io.pry.gradle.offline_dependencies' version '0.5.0'

// This plugin allows you to create different environments
// for your gradle deploy. Each environment is represented
// by a gradle-${env}.properties file
// See https://github.com/stevesaliman/gradle-properties-plugin
// specify the env on the command line with:
// gradle -PenvironmentName=x ...
id 'net.saliman.properties' version '1.4.6'

// This gradle plugin extends the ml-gradle plugin with
// commands that make the Data Hub Framework do its magic
id 'com.marklogic.ml-data-hub' version '4.3.2'

}

repositories {
maven {
url offlineRepositoryRoot
}
}

test {
useJUnitPlatform()
}

offlineDependencies {
repositories {
// You’ll have to add your buildscript repositories here too
maven {url ‘Index of /maven2’}
jcenter()
mavenCentral()
maven {
url “https://plugins.gradle.org/m2/
}
}
dependencies{
mlRestApi “com.marklogic:marklogic-unit-test-modules:0.12.0”
}

includeSources = true
includeJavadocs = true
includePoms = true
includeIvyXmls = true
includeBuildscriptDependencies = true
}

dependencies {
// this allows you to write custom java code that depends
// on the Data Hub Framework library
compile ‘com.marklogic:marklogic-data-hub:4.3.2’
compile ‘com.marklogic:marklogic-xcc:9.0.6’

if ("true".equalsIgnoreCase(project.findProperty("isDeployUnitTestFramework"))) {
    // Needed to execute tests written using marklogic-unit-test
    mlRestApi "com.marklogic:marklogic-unit-test-modules:0.12.0"
}

// Supports testing against MarkLogic via JUnit5
testCompile "com.marklogic:marklogic-junit:0.11.0"

// Needed for verifying the deployment in a JUnit5 test
testCompile "com.marklogic:ml-app-deployer:3.10.1"

// Needed by Gradle 4.6+ to run "gradle test"
testRuntime "org.junit.jupiter:junit-jupiter-engine:5.3.0"

}

Your existing build applies a plugin that appears to do what you’re asking for. The io.pry.gradle.offline_dependencies plugin.