/
build.gradle
62 lines (54 loc) · 1.45 KB
/
build.gradle
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 {
id 'java-library'
id '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 {
myLibrary(MavenPublication) {
from components.java
// end::configure-publishing[]
withBuildIdentifier()
// tag::configure-publishing[]
}
}
// end::enable-build-id[]
repositories {
maven {
name = 'myRepo'
url = layout.buildDirectory.dir("repo")
}
}
// tag::enable-build-id[]
}
// end::configure-publishing[]
// end::enable-build-id[]
// tag::configure-generate-task[]
tasks.withType(GenerateMavenPom).all {
def matcher = name =~ /generatePomFileFor(\w+)Publication/
def publicationName = matcher[0][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).configureEach {
// The value 'enforced-platform' is provided in the validation
// error message you got
suppressedValidationErrors.add('enforced-platform')
}
// end::disable_validation[]