forked from gradle/gradle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
53 lines (46 loc) · 1.22 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
plugins {
id 'java'
id 'maven-publish'
}
group = 'org.gradle.sample'
version = '1.0'
dependencies {
implementation 'commons-collections:commons-collections:3.2.2'
}
repositories {
mavenCentral()
}
// tag::publish-modify-component[]
java {
withJavadocJar()
withSourcesJar()
}
components.java.withVariantsFromConfiguration(configurations.sourcesElements) {
skip()
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
// end::publish-modify-component[]
// tag::repo-url-from-variable[]
// tag::repo-url-from-project-property[]
publishing {
repositories {
maven {
def releasesRepoUrl = layout.buildDirectory.dir('repos/releases')
def snapshotsRepoUrl = layout.buildDirectory.dir('repos/snapshots')
// end::repo-url-from-variable[]
url = project.hasProperty('release') ? releasesRepoUrl : snapshotsRepoUrl
// end::repo-url-from-project-property[]
// tag::repo-url-from-variable[]
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// tag::repo-url-from-project-property[]
}
}
}
// end::repo-url-from-project-property[]
// end::repo-url-from-variable[]