aboutsummaryrefslogtreecommitdiff
path: root/buildSrc/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'buildSrc/src/main/kotlin')
-rw-r--r--buildSrc/src/main/kotlin/org/jetbrains/SetupMaven.kt49
1 files changed, 49 insertions, 0 deletions
diff --git a/buildSrc/src/main/kotlin/org/jetbrains/SetupMaven.kt b/buildSrc/src/main/kotlin/org/jetbrains/SetupMaven.kt
new file mode 100644
index 00000000..519eea13
--- /dev/null
+++ b/buildSrc/src/main/kotlin/org/jetbrains/SetupMaven.kt
@@ -0,0 +1,49 @@
+package org.jetbrains
+
+import org.gradle.api.DefaultTask
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.Internal
+import org.gradle.api.tasks.Sync
+import org.gradle.kotlin.dsl.creating
+import org.gradle.kotlin.dsl.dependencies
+import org.gradle.kotlin.dsl.getValue
+import java.io.File
+
+@Suppress("LeakingThis")
+open class SetupMaven : Sync() {
+ @get:Input
+ var mavenVersion = "3.5.0"
+
+ @get:Input
+ var mavenPluginToolsVersion = "3.5.2"
+
+ @get:Input
+ var aetherVersion = "1.1.0"
+
+ @get:Internal
+ val mavenBuildDir = "${project.buildDir}/maven"
+
+ @get:Internal
+ val mavenBinDir = "${project.buildDir}/maven-bin"
+
+ @get:Internal
+ val mvn = File(mavenBinDir, "apache-maven-$mavenVersion/bin/mvn")
+
+ private val mavenBinaryConfiguration: Configuration by project.configurations.creating {
+ project.dependencies {
+ this@creating.invoke(
+ group = "org.apache.maven",
+ name = "apache-maven",
+ version = mavenVersion,
+ classifier = "bin", ext = "zip"
+ )
+ }
+ }
+
+ init {
+ from(mavenBinaryConfiguration.map { file -> project.zipTree(file) })
+ into(mavenBinDir)
+ }
+
+}