forked from quartz-scheduler/quartz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
140 lines (126 loc) · 5.54 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
import org.gradle.api.publish.maven.internal.publication.MavenPomInternal;
import org.gradle.api.publish.maven.internal.publisher.MavenProjectIdentity;
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) {
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:electric-cloud/quartz.git'
developerConnection = 'scm:git:ssh:[email protected]:electric-cloud/quartz.git'
url = 'https://github.com/electric-cloud/quartz'
}
developers {
developer {
name = "Terracotta Engineers"
email = "[email protected]"
organization = "Terracotta Inc., a wholly-owned subsidiary of Software AG USA, Inc."
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")
)
}
}
}
// 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 ->
MavenProjectIdentity identity = ((MavenPomInternal) pomTask.getPom()).getProjectIdentity();
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", identity.getGroupId());
task.property("artifactId", identity.getArtifactId());
task.property("version", identity.getVersion());
});
project.tasks.withType(Jar).configureEach{jar ->
jar.into("META-INF/maven/" + identity.getGroupId().get() + "/" + identity.getArtifactId().get(), spec -> {
spec.from(pomTask, pom -> pom.rename(".*", "pom.xml"));
spec.from(pomPropertiesTask);
});
}
}
}
}
nexusPublishing {
repositories {
sonatype {
// To get the values for username and password, please refer to the following link:
// https://nexus-internal.cloudbees.com/#profile (Select the "User Token" tab and button "Access Token"
username = 'OVERRIDE_ME'
password = 'OVERRIDE_ME'
stagingProfileId = '7a7e874f6c38' // Staging profile ID
nexusUrl = uri('https://nexus-internal.cloudbees.com/service/local/') // CloudBees Internal Nexus URI
}
}
}