Created
September 17, 2025 01:22
-
-
Save deskoh/749d28dae93eb0fce82d24dac7122887 to your computer and use it in GitHub Desktop.
Gradle Mirror
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plugins { | |
| id 'java' | |
| id 'eclipse' | |
| id 'application' | |
| // id 'io.freefair.lombok' version '8.10' | |
| } | |
| group = 'com.example' | |
| version = '0.0.1-SNAPSHOT' | |
| java { | |
| toolchain { | |
| languageVersion = JavaLanguageVersion.of(21) | |
| } | |
| } | |
| tasks.withType(JavaCompile).configureEach { | |
| options.release.set(21) | |
| } | |
| configurations { | |
| compileOnly { | |
| extendsFrom annotationProcessor | |
| } | |
| } | |
| repositories { | |
| mavenCentral() | |
| } | |
| dependencies { | |
| // implementation 'org.javers:javers-core:6.14.0' | |
| } | |
| eclipse { | |
| classpath { | |
| downloadSources=true | |
| downloadJavadoc=true | |
| } | |
| } | |
| tasks.register('cacheToDir', Copy) { | |
| // use build also does not download test deps | |
| dependsOn 'assemble' | |
| from new File(gradle.gradleUserHomeDir, 'caches/modules-2/files-2.1') | |
| into layout.buildDirectory.dir("cache") | |
| eachFile { | |
| List<String> parts = it.path.split('/') | |
| it.path = parts[0].replace('.','/') + '/' + parts[1] + '/' + parts[2] + '/' + parts[4] | |
| } | |
| includeEmptyDirs false | |
| } | |
| tasks.register('packDeps', Zip) { | |
| dependsOn 'cacheToDir' | |
| archiveFileName = "deps.zip" | |
| destinationDirectory = layout.buildDirectory.dir('dist') | |
| from layout.buildDirectory.dir("cache") | |
| } | |
| task cacheToMavenLocal(type: Copy) { | |
| from new File(gradle.gradleUserHomeDir, 'caches/modules-2/files-2.1') | |
| // into repositories.mavenLocal().url | |
| into "${rootDir}/local-m2" | |
| // Last copy target wins | |
| duplicatesStrategy = 'include' | |
| eachFile { | |
| List<String> parts = it.path.split('/') | |
| // Construct a maven repo file tree from path | |
| it.path = (parts[0].replace('.','/') + '/' + parts[1] + '/' + parts[2]+ '/' + parts[4]) | |
| println it.path | |
| } | |
| includeEmptyDirs false | |
| } | |
| // .\gradlew clean packDeps --refresh-dependencies | |
| // .\gradlew --stop | |
| // rmdir /s/q %USERPROFILE%\.gradle\caches |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment