forked from jcasbin/casbin-spring-boot-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaven.gradle
108 lines (102 loc) · 3.16 KB
/
maven.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
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'io.github.gradle-nexus.publish-plugin'
ext {
ossrhUsername = findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME")
ossrhPassword = findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD")
signingKey = findProperty("signingKey") ?: System.getenv("SIGNING_KEY")
signingPassword = findProperty("signingPassword") ?: System.getenv("SIGNING_PASSWORD")
}
task sourceJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
javadoc {
options {
encoding "UTF-8"
charSet 'UTF-8'
// ignore custom tags
tags = [
"title:a:title",
"package:a:package",
"description:a:description",
"date:a:date"
]
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
publishing {
publications {
mavenJava(MavenPublication) {
// GAV configuration
from components.java
artifact sourceJar
artifact javadocJar
afterEvaluate {
groupId = GROUP
artifactId = ARTIFACT_ID
version = project.version
}
// resolve the dynamic dependency version into the actual reference version, e.g., 1.2.+ -> 1.2.10
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
// pom relative information
pom {
name = ARTIFACT_ID
description = POM_DESCRIPTION
url = POM_URL
scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}
issueManagement {
system = 'Github'
url = ISSUE_URL
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
email = POM_DEVELOPER_EMAIL
url = POM_DEVELOPER_URL
}
}
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
distribution = POM_LICENCE_DIST
}
}
}
}
}
}
tasks.withType(GenerateMavenPom).all {
destination = "$buildDir/libs/${project.name}-${project.version}.pom"
}
build.dependsOn('sourceJar')
build.dependsOn('javadocJar')
build.dependsOn('generatePomFileForMavenJavaPublication')
signing {
useInMemoryPgpKeys(signingKey, signingPassword ?: "")
sign publishing.publications.mavenJava
}
nexusPublishing {
repositories {
sonatype {
username = ossrhUsername
password = ossrhPassword
}
}
}