-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
117 lines (102 loc) · 3.94 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
* User Manual available at https://docs.gradle.org/7.4/userguide/building_java_projects.html
*/
group = "org.phpinnacle.toblerone"
version = System.getenv("VERSION") ?: "1.0.0"
val javaVersion = 11
val artifactoryContext =
project.properties.getOrDefault("artifactory_context", System.getenv("ARTIFACTORY_CONTEXT")).toString()
val artifactoryUsern =
project.properties.getOrDefault("artifactory_user", System.getenv("ARTIFACTORY_USER")).toString()
val artifactoryPassword =
project.properties.getOrDefault("artifactory_password", System.getenv("ARTIFACTORY_PWD")).toString()
plugins {
kotlin("jvm") version "1.9.22"
idea // Generates files that are used by IntelliJ IDEA, thus making it possible to open the project from IDEA
`java-library` // Apply the java-library plugin for API and implementation separation.
`maven-publish`
id("io.gitlab.arturbosch.detekt") version "1.20.0"
}
repositories {
mavenCentral()
}
dependencies {
val kafkaConnectVersion = "3.7.+"
val junitVersion = "5.8.2"
compileOnly(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.apache.kafka:connect-api:$kafkaConnectVersion")
implementation("org.apache.kafka:connect-json:$kafkaConnectVersion")
implementation("org.apache.kafka:connect-transforms:$kafkaConnectVersion")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
}
kotlin {
jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(javaVersion))
}
}
tasks {
val fatJar = register<Jar>("fatJar") {
dependsOn.addAll(listOf("compileJava", "compileKotlin", "processResources"))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest { attributes(mapOf("Main-Class" to "org.phpinnacle.toblerone")) }
val sourcesMain = sourceSets.main.get()
val contents = configurations.runtimeClasspath.get()
.map { if (it.isDirectory) it else zipTree(it) } +
sourcesMain.output
from(contents)
}
build {
dependsOn(fatJar) // Trigger fat jar creation during build
}
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group.toString()
artifactId = project.name
version = project.version.toString()
pom {
name.set( "phpinncle-toblerone")
description.set( project.description)
url.set("https://github.com/phpinnacle/toblerone")
organization {
name.set("phpinnacle")
url.set("https://github.com/phpinnacle")
}
issueManagement {
system.set("GitHub")
url.set("https://github.com/phpinnacle/toblerone/issues")
}
licenses {
license {
name.set( "Apache License 2.0")
url.set("https://github.com/phpinnacle/toblerone/blob/master/LICENSE")
distribution.set("repo")
}
}
developers {
developer {
name.set("phpinnacle")
}
}
scm {
url.set("https://github.com/phpinnacle/toblerone")
connection.set("scm:git:git://github.com/phpinnacle/toblerone.git")
developerConnection.set("scm:git:ssh://[email protected]:phpinnacle/toblerone.git")
}
}
from(components["java"])
}
}
repositories {
maven {
name = "ArtifactoryLocal"
url = uri(artifactoryContext + "/libs-release-local")
credentials {
username = artifactoryUsern
password = artifactoryPassword
}
}
}
}