-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
170 lines (162 loc) · 4.92 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
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'java'
}
group 'fr.techad'
version '2.1.0'
sourceCompatibility = 1.8
ext.withDependencies=project.hasProperty('withDependencies')
//Used to be able to add dependencies to jar
if(withDependencies){
configurations.implementation.setCanBeResolved(true)
configurations.api.setCanBeResolved(true)
}
java {
withJavadocJar()
withSourcesJar()
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
// light-4j
implementation 'com.networknt:server:2.1.1'
implementation 'ch.qos.logback:logback-classic:1.4.4'
implementation 'commons-io:commons-io:2.11.0'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.apache.lucene:lucene-analysis-common:9.4.2'
implementation 'org.apache.lucene:lucene-core:9.4.2'
implementation 'org.apache.lucene:lucene-queryparser:9.4.2'
implementation 'org.jsoup:jsoup:1.15.3'
implementation 'com.auth0:java-jwt:4.0.0'
implementation 'net.lingala.zip4j:zip4j:2.11.2'
implementation 'org.json:json:20220924'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
testImplementation 'org.mockito:mockito-all:1.9.5'
}
//Jar creation
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
if(withDependencies){
attributes(
'Main-Class': 'fr.techad.edc.httpd.EdcWebServer'
)
}
}
from {
if(withDependencies){
configurations.implementation.collect { it.isDirectory() ? it : zipTree(it) }
}
}
}
shadowJar {
archiveBaseName.set('edc-httpd-java')
archiveClassifier.set('')
archiveVersion.set('2.1.0')
mergeServiceFiles()
manifest {
attributes 'Main-Class': 'fr.techad.edc.httpd.EdcWebServer'
}
}
//Execute Junit tests
test {
useJUnitPlatform()
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'edc-httpd'
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
//Creating the pom
pom {
name = 'edc httpd'
description = 'Embedded httpd server to serve the help documentation published by edc'
url = 'https://www.easydoccontents.com'
licenses {
license {
name = 'MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
distribution = 'repo'
}
}
developers {
developer {
name = 'Gregory Cochin'
email= '[email protected]'
}
developer {
name = 'Mathieu Benard'
email= '[email protected]'
}
developer {
name = 'Florian Bracq'
email= '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/tech-advantage/edc-httpd.git'
developerConnection = 'scm:git:ssh://github.com/tech-advantage/edc-httpd.git'
url = 'https://github.com/tech-advantage/edc-httpd'
}
}
}
}
repositories {
maven {
def releasesRepoUrl = layout.buildDirectory.dir('repos/releases')
def snapshotsRepoUrl = layout.buildDirectory.dir('repos/snapshots')
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}
signing {
setRequired {
// signing is only required if the artifacts are to be published
gradle.taskGraph.allTasks.any { it.equals( PublishToMavenRepository) }
}
sign publishing.publications.mavenJava
sign configurations.archives
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
artifacts {
shadowJar
archives sourcesJar
archives javadocJar
}
javadoc {
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
tasks.build.dependsOn tasks.shadowJar
task install(dependsOn: publishToMavenLocal) {
group = 'Publishing'
description = 'Installs artifacts to local Maven repository'
}
task release() {
group 'Project'
description 'Build project as release.'
dependsOn build
dependsOn javadoc
}
build.dependsOn(shadowJar);