-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
build.gradle
142 lines (128 loc) · 5.49 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
import org.gradle.api.publish.maven.internal.publication.MavenPomInternal;
import org.gradle.api.publish.maven.internal.publisher.MavenPublicationCoordinates;
import static org.gradle.api.publish.plugins.PublishingPlugin.PUBLISH_TASK_GROUP;
plugins {
// This adds tasks to auto close or release nexus staging repos
// see https://github.com/gradle-nexus/publish-plugin/
id "io.github.gradle-nexus.publish-plugin"
}
allprojects {
group 'org.quartz-scheduler'
version quartzVersion
}
subprojects {
repositories {
mavenCentral()
}
}
allprojects {
plugins.withType(JavaBasePlugin) {
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
}
plugins.withType(MavenPublishPlugin) {
plugins.apply(SigningPlugin)
signing {
required { !version.endsWith("SNAPSHOT") }
sign publishing.publications
}
publishing {
configurations {
provided
runtimeClasspath.extendsFrom(provided)
}
publications {
maven(MavenPublication) {
pom {
name = "$project.name"
url = 'https://www.quartz-scheduler.org/'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
connection = 'scm:git:git://github.com:quartz-scheduler/quartz.git'
developerConnection = 'scm:git:ssh:[email protected]:quartz-scheduler/quartz.git'
url = 'https://github.com/quartz-scheduler/quartz'
}
developers {
developer {
name = "Terracotta Engineers"
email = "[email protected]"
organization = "Super iPaaS Integration LLC, an IBM Company"
organizationUrl = "http://www.quartz-scheduler.org/"
}
}
}
from components.java
pom.withXml {
asNode()
.dependencies
.dependency
.findAll { dependency ->
// Patch up dependency scopes per expectations of maven users
(dependency.groupId.text() == 'com.mchange' ||
dependency.groupId.text() == 'com.zaxxer' ||
dependency.artifactId.text() == 'slf4j-log4j12' ||
dependency.groupId.text() == 'jakarta.xml' )
}
.each { dependency ->
// Set scope value to compile.
dependency.scope*.value = 'provided'
}
}
}
}
}
// for MANIFEST.MF
jar {
manifest {
attributes(
"Implementation-Title": project.name,
"Implementation-Vendor-Id": project.group,
"Implementation-Version": project.version,
"Built-By": System.getProperty("user.name"),
"Built-JDK": System.getProperty("java.version"),
"Automatic-Module-Name": 'org.quartz',
"-removeheaders": 'Private-Package',
"Export-Package": 'org.quartz.*',
"Import-Package": '*;resolution:=optional'
)
}
}
}
// Put pom.xml and pom.properties in the jar:
project.afterEvaluate{p ->
// module.json publishing confuses sonatype and it doesn't process the jar.
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
tasks.withType(GenerateMavenPom) {pomTask ->
MavenPublicationCoordinates coordinates = ((MavenPomInternal) pomTask.getPom()).getCoordinates()
TaskProvider<WriteProperties> pomPropertiesTask = project.getTasks().register(pomTask.getName().replace("PomFile", "PomProperties"), WriteProperties.class, task -> {
task.dependsOn(pomTask);
task.setGroup(PUBLISH_TASK_GROUP);
task.setOutputFile(new File(pomTask.getDestination().getParentFile(), "pom.properties"));
task.property("groupId", coordinates.getGroupId());
task.property("artifactId", coordinates.getArtifactId());
task.property("version", coordinates.getVersion());
});
project.tasks.withType(Jar).configureEach{jar ->
jar.into("META-INF/maven/" + coordinates.getGroupId().get() + "/" + coordinates.getArtifactId().get(), spec -> {
spec.from(pomTask, pom -> pom.rename(".*", "pom.xml"));
spec.from(pomPropertiesTask);
});
}
}
}
}
nexusPublishing {
repositories {
sonatype()
}
}