-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
171 lines (149 loc) · 4.98 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
plugins {
id 'java'
id 'idea'
id 'groovy'
id 'signing'
id 'maven-publish'
}
group = 'com.github.joutvhu'
version '1.1.5'
sourceCompatibility = 1.8
targetCompatibility = 1.8
def snapshotVersion = version.endsWith('-SNAPSHOT') || version.endsWith('.SNAPSHOT')
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.12'
compileOnly 'org.projectlombok:lombok:1.18.12'
implementation 'org.apache.commons:commons-lang3:3.11'
implementation "com.google.re2j:re2j:1.4"
implementation "org.reflections:reflections:0.9.12"
implementation "com.fasterxml.jackson.core:jackson-core:2.11.2"
implementation "com.fasterxml.jackson.core:jackson-databind:2.11.2"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.2"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.2"
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.6.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.2'
testCompileOnly 'org.projectlombok:lombok:1.18.12'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
}
jar {
manifest {
attributes 'Built-By': 'joutvhu (Giao Ho)'
}
into("META-INF/maven/${project.group}/${project.name}") {
from {
generatePomFileForMavenPublication
}
rename {
it.replace('pom-default.xml', 'pom.xml')
}
}
}
task fatJar(type: Jar) {
manifest.from jar.manifest
with jar
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives fatJar, sourcesJar, javadocJar
}
tasks.withType(Test) {
useJUnitPlatform()
filter {
includeTestsMatching 'com.joutvhu.fixedwidth.parser.*'
}
}
publishing {
publications {
maven(MavenPublication) {
groupId = group
artifactId = project.name
artifacts = [fatJar, sourcesJar, javadocJar]
version = version
pom {
name = project.name
description = 'Parse fixed width string to object and export object to fixed width string'
url = 'https://github.com/joutvhu/fixed-width-parser'
licenses {
license {
name = 'MIT License'
url = 'https://github.com/joutvhu/fixed-width-parser/blob/master/LICENSE'
}
}
developers {
developer {
id = 'joutvhu'
name = 'Giao Ho'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:[email protected]:joutvhu/fixed-width-parser.git'
developerConnection = 'scm:git:[email protected]:joutvhu/fixed-width-parser.git'
url = 'https://github.com/joutvhu/fixed-width-parser'
}
issueManagement {
system = 'Github Issue'
url = 'https://github.com/joutvhu/fixed-width-parser/issues'
}
organization {
name = 'Giao Ho'
url = 'https://github.com/joutvhu'
}
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.implementation.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
repositories {
maven {
name = 'sonatype'
if (snapshotVersion) {
url = 'https://oss.sonatype.org/content/repositories/snapshots'
} else {
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
}
credentials {
username = project.ossrhUsername
password = project.ossrhPassword
}
}
maven {
name = 'github'
url = "https://maven.pkg.github.com/joutvhu/fixed-width-parser"
credentials {
username = project.githubUsername
password = project.githubPassword
}
}
}
}
signing {
sign publishing.publications.maven
}
tasks.publishMavenPublicationToGithubRepository.configure {
onlyIf { !snapshotVersion }
}