1
1
plugins {
2
2
id ' java'
3
+ id ' idea'
4
+ id ' groovy'
5
+ id ' signing'
6
+ id ' maven-publish'
3
7
}
4
8
5
9
group ' com.github.joutvhu'
6
- version ' 1.0 .0-SNAPSHOT'
10
+ version ' 0.1 .0-SNAPSHOT'
7
11
sourceCompatibility = 1.8
8
12
targetCompatibility = 1.8
9
13
14
+ def snapshotVersion = version. endsWith(' -SNAPSHOT' ) || version. endsWith(' .SNAPSHOT' )
15
+
16
+ configurations {
17
+ compileOnly {
18
+ extendsFrom annotationProcessor
19
+ }
20
+ }
21
+
10
22
repositories {
23
+ mavenLocal()
11
24
mavenCentral()
12
25
}
13
26
14
27
dependencies {
15
- annotationProcessor ' org.projectlombok:lombok:1.18.12 '
16
- compileOnly ' org.projectlombok:lombok:1.18.12 '
28
+ annotationProcessor ' org.projectlombok:lombok:1.18.20 '
29
+ compileOnly ' org.projectlombok:lombok:1.18.20 '
17
30
18
31
implementation ' org.apache.commons:commons-lang3:3.12.0'
19
32
20
- testImplementation ' org.junit.jupiter:junit-jupiter-api:5.7.0'
21
- testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.7.0'
33
+ testImplementation ' org.junit.jupiter:junit-jupiter-api:5.7.2'
34
+ testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.7.2'
35
+
36
+ testCompileOnly ' org.projectlombok:lombok:1.18.20'
37
+ testAnnotationProcessor ' org.projectlombok:lombok:1.18.20'
38
+ }
39
+
40
+ jar {
41
+ manifest {
42
+ attributes ' Built-By' : ' joutvhu (Giao Ho)'
43
+ }
44
+ into(" META-INF/maven/${ project.group} /${ project.name} " ) {
45
+ from {
46
+ generatePomFileForMavenPublication
47
+ }
48
+ rename {
49
+ it. replace(' pom-default.xml' , ' pom.xml' )
50
+ }
51
+ }
52
+ }
53
+
54
+ task fatJar (type : Jar ) {
55
+ manifest. from jar. manifest
56
+ with jar
57
+ }
58
+
59
+ task sourcesJar (type : Jar , dependsOn : classes) {
60
+ classifier = ' sources'
61
+ from sourceSets. main. allSource
62
+ }
63
+
64
+ task javadocJar (type : Jar , dependsOn : javadoc) {
65
+ classifier = ' javadoc'
66
+ from javadoc. destinationDir
67
+ }
68
+
69
+ artifacts {
70
+ archives fatJar, sourcesJar, javadocJar
71
+ }
22
72
23
- testCompileOnly ' org.projectlombok:lombok:1.18.12'
24
- testAnnotationProcessor ' org.projectlombok:lombok:1.18.12'
73
+ tasks. withType(Test ) {
74
+ useJUnitPlatform {
75
+ includeEngines ' junit-jupiter'
76
+ }
77
+ filter {
78
+ includeTestsMatching ' com.joutvhu.date.parser.*'
79
+ }
25
80
}
26
81
27
- test {
28
- useJUnitPlatform()
29
- }
82
+ publishing {
83
+ publications {
84
+ maven(MavenPublication ) {
85
+ groupId = group
86
+ artifactId = project. name
87
+ artifacts = [fatJar, sourcesJar, javadocJar]
88
+ version = version
89
+
90
+ pom {
91
+ name = project. name
92
+ description = ' Utility to parse String to Date by target type and string format'
93
+ url = ' https://github.com/joutvhu/date-parser'
94
+ licenses {
95
+ license {
96
+ name = ' MIT License'
97
+ url = ' https://github.com/joutvhu/date-parser/blob/master/LICENSE'
98
+ }
99
+ }
100
+ developers {
101
+ developer {
102
+ id = ' joutvhu'
103
+ name = ' Giao Ho'
104
+
105
+ }
106
+ }
107
+ scm {
108
+ connection
= ' scm:git:[email protected] :joutvhu/date-parser.git'
109
+ developerConnection
= ' scm:git:[email protected] :joutvhu/date-parser.git'
110
+ url = ' https://github.com/joutvhu/date-parser'
111
+ }
112
+ issueManagement {
113
+ system = ' Github Issue'
114
+ url = ' https://github.com/joutvhu/date-parser/issues'
115
+ }
116
+ organization {
117
+ name = ' Giao Ho'
118
+ url = ' https://github.com/joutvhu'
119
+ }
120
+ withXml {
121
+ def dependenciesNode = asNode(). appendNode(' dependencies' )
122
+
123
+ configurations. implementation. allDependencies. each {
124
+ def dependencyNode = dependenciesNode. appendNode(' dependency' )
125
+ dependencyNode. appendNode(' groupId' , it. group)
126
+ dependencyNode. appendNode(' artifactId' , it. name)
127
+ dependencyNode. appendNode(' version' , it. version)
128
+ }
129
+ }
130
+ }
131
+ }
132
+ }
133
+ repositories {
134
+ maven {
135
+ name = ' sonatype'
136
+ if (snapshotVersion) {
137
+ url = ' https://oss.sonatype.org/content/repositories/snapshots'
138
+ } else {
139
+ url = ' https://oss.sonatype.org/service/local/staging/deploy/maven2'
140
+ }
141
+ credentials {
142
+ username = project. ossrhUsername
143
+ password = project. ossrhPassword
144
+ }
145
+ }
146
+ maven {
147
+ name = ' github'
148
+ url = ' https://maven.pkg.github.com/joutvhu/date-parser'
149
+ credentials {
150
+ username = project. githubUsername
151
+ password = project. githubPassword
152
+ }
153
+ }
154
+ }
155
+ }
156
+
157
+ signing {
158
+ sign publishing. publications. maven
159
+ }
160
+
161
+ tasks. publishMavenPublicationToGithubRepository. configure {
162
+ onlyIf { ! snapshotVersion }
163
+ }
0 commit comments