1
1
plugins {
2
2
id " java-library"
3
+ id " maven-publish"
4
+ id " signing"
3
5
}
4
6
5
7
group " ai.djl.jsr381"
6
- version " 0.3.0"
8
+ boolean isRelease = project. hasProperty(" release" ) || project. hasProperty(" staging" )
9
+ version = " 0.3.0" + (isRelease ? " " : " -SNAPSHOT" )
7
10
8
11
dependencies {
9
12
api " javax.visrec:visrec-api:1.0-SNAPSHOT"
@@ -21,9 +24,95 @@ dependencies {
21
24
}
22
25
}
23
26
27
+ java {
28
+ withJavadocJar()
29
+ withSourcesJar()
30
+ }
31
+
24
32
test {
25
33
// Use TestNG for unit tests
26
34
useTestNG()
27
35
}
28
36
29
37
apply from : file(" ${ rootProject.projectDir} /tools/gradle/formatter.gradle" )
38
+
39
+ project. tasks. withType(GenerateModuleMetadata ) {
40
+ enabled = false
41
+ }
42
+
43
+ signing {
44
+ required(project. hasProperty(" staging" ) || project. hasProperty(" snapshot" ))
45
+ def signingKey = findProperty(" signingKey" )
46
+ def signingPassword = findProperty(" signingPassword" )
47
+ useInMemoryPgpKeys(signingKey, signingPassword)
48
+ sign publishing. publications
49
+ }
50
+
51
+ if (JavaVersion . current() != JavaVersion . VERSION_1_8 ) {
52
+ if (gradle. startParameter. taskNames. contains(" publish" )) {
53
+ throw new GradleException (" JDK 1.8 is required to run publish task." )
54
+ }
55
+ return
56
+ }
57
+
58
+ publishing {
59
+ publications {
60
+ maven(MavenPublication ) {
61
+ from components. java
62
+ artifacts = [jar, javadocJar, sourcesJar]
63
+ pom {
64
+ name = " Deep Java Library implementation of JSR-381"
65
+ description = " Deep Java Library implementation of JSR-381"
66
+ url = " http://www.djl.ai/"
67
+
68
+ packaging = " jar"
69
+
70
+ licenses {
71
+ license {
72
+ name = ' The Apache License, Version 2.0'
73
+ url = ' https://www.apache.org/licenses/LICENSE-2.0'
74
+ }
75
+ }
76
+
77
+ scm {
78
+ connection
= " scm:git:[email protected] :awslabs/djl.git"
79
+ developerConnection
= " scm:git:[email protected] :awslabs/djl.git"
80
+ url = " https://github.com/awslabs/djl"
81
+ tag = " HEAD"
82
+ }
83
+
84
+ developers {
85
+ developer {
86
+ name = " DJL.AI Team"
87
+
88
+ organization = " Amazon AI"
89
+ organizationUrl = " https://amazon.com"
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+
96
+ repositories {
97
+ maven {
98
+ if (project. hasProperty(" snapshot" )) {
99
+ name = " snapshot"
100
+ url = " https://oss.sonatype.org/content/repositories/snapshots/"
101
+ credentials {
102
+ username = findProperty(" ossrhUsername" )
103
+ password = findProperty(" ossrhPassword" )
104
+ }
105
+ } else if (project. hasProperty(" staging" )) {
106
+ name = " staging"
107
+ url = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
108
+ credentials {
109
+ username = findProperty(" ossrhUsername" )
110
+ password = findProperty(" ossrhPassword" )
111
+ }
112
+ } else {
113
+ name = " local"
114
+ url = " build/repo"
115
+ }
116
+ }
117
+ }
118
+ }
0 commit comments