-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
145 lines (130 loc) · 3.99 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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
plugins {
id 'java-library'
id 'idea'
id 'signing'
id 'maven-publish'
}
import org.gradle.internal.os.OperatingSystem
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
group projGroupId
archivesBaseName = projArtifactId
version = projVersion
repositories {
mavenCentral()
maven { url 'https://maven.aliyun.com/repository/central' }
// temporary maven repositories
maven { url 'https://s01.oss.sonatype.org/content/repositories/releases' }
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots' }
}
dependencies {
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
jar {
manifestContentCharset 'utf-8'
metadataCharset 'utf-8'
from 'LICENSE'
manifest.attributes(
'Specification-Title': projName,
'Specification-Vendor': 'Overrun Organization',
'Specification-Version': '0',
'Implementation-Title': projName,
'Implementation-Vendor': 'Overrun Organization',
'Implementation-Version': archiveVersion
)
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set 'sources'
from sourceSets.main.allSource, 'LICENSE'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set 'javadoc'
from javadoc, 'LICENSE'
}
artifacts {
archives javadocJar, sourcesJar
}
java {
withJavadocJar()
withSourcesJar()
}
javadoc {
failOnError = false
options.encoding 'UTF-8'
options.charSet 'UTF-8'
options.author true
options.links "https://docs.oracle.com/javase/8/docs/api/"
options.windowTitle "$projName $projVersion Javadoc"
}
publishing.publications {
mavenJava(MavenPublication) {
groupId = projGroupId
artifactId = projArtifactId
version = projVersion
description = projDesc
from components.java
pom {
name = projName
description = projDesc
url = "https://github.com/$projVcs"
licenses {
license {
name = 'The MIT License'
url = "https://raw.githubusercontent.com/$projVcs/$projBranch/LICENSE"
}
}
organization {
name = orgName
url = orgUrl
}
developers {
String[] prop = project.developers.split(',')
for (String s : prop) {
String[] dev = s.split(':', 3)
developer {
id = dev[0]
name = dev[1]
email = dev[2]
}
}
}
scm {
connection = "https://github.com/${projVcs}.git"
developerConnection = "https://github.com/${projVcs}.git"
url = "https://github.com/$projVcs"
}
}
}
gpr(MavenPublication) {
from(components.java)
}
}
// You have to 'OSSRH_USERNAME', 'OSSRH_PASSWORD', 'signing.keyId',
// 'signing.password' and 'signing.secretKeyRingFile' to
// GRADLE_USER_HOME/gradle.properties
publishing.repositories {
maven {
name = "OSSRH"
credentials {
username = project.findProperty("OSSRH_USERNAME") ?: "null"
password = project.findProperty("OSSRH_PASSWORD") ?: "null"
}
url = version.endsWith('-SNAPSHOT')
? "https://s01.oss.sonatype.org/content/repositories/snapshots/"
: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/$projVcs")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
}
signing {
if (Boolean.parseBoolean(System.getProperty("gpg.signing", "true")))
sign publishing.publications.mavenJava
}
idea.module.inheritOutputDirs = true