-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
177 lines (153 loc) · 5.14 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
def checkProperty(Project project, String propName) {
if (!project.hasProperty(propName)) return false
String prop = project.property(propName)
return prop != null && prop.length() > 0
}
def getPropertyOrElse(Project project, String propName, String alternative) {
if (!checkProperty(project, propName)) return alternative
return project.property(propName)
}
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'http://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'ch.raffael.markdown-doclet:markdown-doclet:1.4'
}
}
plugins {
id 'idea'
id 'java-library'
id 'maven'
}
//*************************************************************************
// IDEA
//*************************************************************************
idea {
module {
inheritOutputDirs = true
downloadSources = true
}
}
//*************************************************************************
// Sub Project Config
//*************************************************************************
repositories {
jcenter()
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
}
apply plugin: 'java'
apply plugin: 'ch.raffael.markdown-doclet'
apply plugin: 'maven-publish'
apply plugin: 'signing'
group = 'org.laxture.spring-static-ctx'
dependencies {
implementation 'org.springframework:spring-context:5.2.0.RELEASE'
}
//*************************************************************************
// Properties
//*************************************************************************
Properties localProp = new Properties()
try {
localProp.load(project.rootProject.file('local.properties').newDataInputStream())
} catch(Exception ignored) {}
for (String propKey in localProp.keys()) {
ext.set(propKey, localProp.get(propKey))
}
ext."signing.secretKeyRingFile" = rootProject.file('publish.gpg')
task setProperties {
doFirst {
project.ext.executable = "$project.name"
}
}
//*************************************************************************
// Compile & Assemble
//*************************************************************************
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
tasks.withType(AbstractCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
}
jar {
manifest.attributes provider: 'gradle'
enabled true
doFirst {
archiveFileName = "$project.name-$version.${archiveExtension.get()}"
}
}
//*************************************************************************
// Maven
//*************************************************************************
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
group = 'org.laxture'
publishing {
publications {
mavenJava(MavenPublication) {
groupId = project.getGroup()
from components.java
artifact sourcesJar
artifact javadocJar
pom {
name = project.name
description = 'A Spring helper to get `ApplicationContext` in static way.'
url = 'https://github.com/hank-cp/spring-static-ctx'
organization {
name = 'org.laxture'
url = 'https://laxture.org'
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/hank-cp/spring-static-ctx/issues'
}
license {
name = 'Apache License 3.0'
url = 'https://github.com/hank-cp/spring-static-ctx/blob/master/LICENSE'
distribution = 'repo'
}
scm {
url = 'https://github.com/hank-cp/spring-static-ctx'
connection = 'scm:git:git://github.com/hank-cp/spring-static-ctx.git'
developerConnection = 'scm:git:ssh://[email protected]:hank-cp/spring-static-ctx.git'
}
developers {
developer {
name = 'Hank CP'
email = '[email protected]'
}
}
}
repositories {
maven {
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
def stagingRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : stagingRepoUrl
credentials {
username getPropertyOrElse(project, 'sonatypeUsername', '')
password getPropertyOrElse(project, 'sonatypePassword', '')
}
}
}
}
}
}
signing {
sign publishing.publications.mavenJava
}