-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
52 lines (45 loc) · 1.57 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
import java.text.SimpleDateFormat
import java.util.*
rootProject.extra.set("artifactVersion", SimpleDateFormat("yyyy-MM-dd\'T\'HH-mm-ss").format(Date()))
plugins {
id("maven-publish")
id("com.github.ben-manes.versions") version "0.51.0"
id("net.ossindex.audit") version "0.4.11"
id("io.freefair.maven-central.validate-poms") version "8.11"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}
val dependencyVersions = listOf(
"org.apache.commons:commons-lang3:3.17.0",
"org.jetbrains:annotations:26.0.1",
"junit:junit:4.13.2"
)
val dependencyGroupVersions = mapOf<String, String>(
)
subprojects {
configurations.all {
resolutionStrategy {
failOnVersionConflict()
force(dependencyVersions)
eachDependency {
val forcedVersion = dependencyGroupVersions[requested.group]
if (forcedVersion != null) {
useVersion(forcedVersion)
}
}
}
}
}
fun findProperty(s: String) = project.findProperty(s) as String?
val isSnapshot = project.version == "unspecified"
nexusPublishing {
repositories {
if (!isSnapshot) {
sonatype {
// 'sonatype' is pre-configured for Sonatype Nexus (OSSRH) which is used for The Central Repository
stagingProfileId.set(System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: findProperty("sonatype.staging.profile.id")) //can reduce execution time by even 10 seconds
username.set(System.getenv("SONATYPE_USERNAME") ?: findProperty("sonatype.username"))
password.set(System.getenv("SONATYPE_PASSWORD") ?: findProperty("sonatype.password"))
}
}
}
}