forked from gradle/gradle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
62 lines (54 loc) · 1.5 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
// tag::apply-plugins[]
plugins {
`java-library`
`maven-publish`
}
// end::apply-plugins[]
repositories {
mavenCentral()
}
dependencies {
api("commons-httpclient:commons-httpclient:3.1")
implementation("org.apache.commons:commons-lang3:3.5")
}
// tag::configure-publishing[]
group = "org.example"
version = "1.0"
// tag::enable-build-id[]
publishing {
publications {
create<MavenPublication>("myLibrary") {
from(components["java"])
// end::configure-publishing[]
withBuildIdentifier()
// tag::configure-publishing[]
}
}
// end::enable-build-id[]
repositories {
maven {
name = "myRepo"
url = uri(layout.buildDirectory.dir("repo"))
}
}
// tag::enable-build-id[]
}
// end::configure-publishing[]
// end::enable-build-id[]
// tag::configure-generate-task[]
tasks.withType<GenerateMavenPom>().configureEach {
val matcher = Regex("""generatePomFileFor(\w+)Publication""").matchEntire(name)
val publicationName = matcher?.let { it.groupValues[1] }
destination = layout.buildDirectory.file("poms/${publicationName}-pom.xml").get().asFile
}
// end::configure-generate-task[]
dependencies {
implementation(enforcedPlatform("org.junit:junit-bom:5.7.1"))
}
// tag::disable_validation[]
tasks.withType<GenerateModuleMetadata> {
// The value 'enforced-platform' is provided in the validation
// error message you got
suppressedValidationErrors.add("enforced-platform")
}
// end::disable_validation[]