@@ -6,12 +6,24 @@ plugins {
66 id ' java'
77 id ' war'
88 id ' jacoco'
9+ id ' maven-publish'
910 id ' org.ajoberstar.grgit' version ' 4.1.1'
1011 id ' com.github.johnrengelman.shadow' version ' 8.1.1'
1112}
1213
14+ group = ' com.github.kbase'
15+
1316repositories {
1417 mavenCentral()
18+
19+ maven {
20+ name = " Clojars"
21+ url = " https://repo.clojars.org/"
22+ }
23+ maven {
24+ name = " JitPack"
25+ url = ' https://jitpack.io'
26+ }
1527}
1628// Warning - these values are hard coded in AuthController.java
1729def JAR_TEMPLATE_DIR = ' kbase_auth2_templates'
@@ -26,13 +38,9 @@ task buildGitCommitFile {
2638}
2739
2840compileJava {
29- if (JavaVersion . current() <= JavaVersion . VERSION_1_8 ) {
30- // TODO BUILD remove when we no longer support java 8
31- java. sourceCompatibility = JavaVersion . VERSION_1_8
32- java. targetCompatibility = JavaVersion . VERSION_1_8
33- } else {
34- options. release = 8
35- }
41+ // TODO BUILD remove when we no longer support java 8, use `options.release = 11` if needed
42+ java. sourceCompatibility = JavaVersion . VERSION_1_8
43+ java. targetCompatibility = JavaVersion . VERSION_1_8
3644 finalizedBy buildGitCommitFile
3745}
3846
@@ -136,23 +144,17 @@ java -cp build/classes/java/main:\$CLASSPATH us.kbase.auth2.cli.AuthCLI \$@
136144 }
137145}
138146
139- def fromURL = { url , name ->
140- File file = new File (" $buildDir /download/${ name} .jar" )
141- file. parentFile. mkdirs()
142- if (! file. exists()) {
143- new URL (url). withInputStream { downloadStream ->
144- file. withOutputStream { fileOut ->
145- fileOut << downloadStream
146- }
147+ publishing {
148+ publications {
149+ shadow(MavenPublication ) { publication ->
150+ project. shadow. component(publication)
151+ artifactId = " auth2-test-shadow-all"
147152 }
148153 }
149- files(file. absolutePath)
150154}
151155
152156dependencies {
153157
154- // ### General application dependencies ###
155-
156158 /* Notes on exclusions:
157159 * Bizarrely, the glassfish verison of inject has a dependency on v1 inject, which
158160 * causes problems when trying to build the fat jar
@@ -171,6 +173,20 @@ dependencies {
171173 implementation ' org.mongodb:mongodb-driver-sync:4.11.1'
172174 implementation ' org.mongodb:bson-record-codec:4.11.1'
173175 implementation ' org.mongodb:bson:4.11.1'
176+ implementation(' com.github.kbase:java_common:0.3.0' ) {
177+ exclude group : ' net.java.dev.jna' // breaks shadow jar
178+ exclude group : ' org.eclipse.jetty.aggregate' // ugh, java common pollutes everything
179+ exclude group : ' com.fasterxml.jackson.core' // breaks everything if we upgrade
180+ exclude group : ' javax.servlet' , module : ' servlet-api' // 2.5 vs 3.1 below
181+ // I have no idea why, but including the auth client in the build causes the shadow
182+ // jar to fail to start correctly. It shouldn't be a problem, but it is
183+ exclude group : ' com.github.kbase' , module : ' auth2_client_java'
184+ }
185+ implementation ' ch.qos.logback:logback-classic:1.1.2'
186+ implementation ' org.slf4j:slf4j-api:1.7.25'
187+ // TODO DEPS Need to rework the java common logger to not use syslog4j at all since it's
188+ // abandonware and has a ton of CVEs, even in the newer versions.
189+ implementation " org.syslog4j:syslog4j:0.9.46"
174190 implementation ' com.github.spullara.mustache.java:compiler:0.9.3'
175191 implementation ' com.nulab-inc:zxcvbn:1.2.2'
176192 implementation ' nl.basjes.parse.useragent:yauaa:1.3'
@@ -196,28 +212,6 @@ dependencies {
196212 implementation ' javax.xml.bind:jaxb-api:2.4.0-b180830.0359'
197213
198214
199- // ### Logging dependencies ###
200- implementation fromURL(
201- ' https://github.com/kbase/jars/raw/master/lib/jars/kbase/common/kbase-common-0.2.0.jar' ,
202- ' kbase-common-0.2.0'
203- )
204- implementation ' ch.qos.logback:logback-classic:1.1.2'
205- implementation ' org.slf4j:slf4j-api:1.7.25'
206- // Syslog4j 0.9.46 doesn't appear to be available on Maven. It apparently lives in
207- // a JetBrains artifact server, but that's too much trouble and there's only one version there
208- // anyway.
209- // https://mvnrepository.com/artifact/org.jetbrains/syslog4j/0.9.46
210- // Need to rework the java common logger to not use syslog4j at all since it's abandonware
211- // and has a ton of CVEs, even in the newer versions.
212- implementation fromURL(
213- ' https://github.com/kbase/jars/raw/master/lib/jars/syslog4j/syslog4j-0.9.46.jar' ,
214- ' syslog4j-0.9.46'
215- )
216- // needed for syslog4j
217- implementation ' joda-time:joda-time:2.3'
218-
219- // ### Test ###
220-
221215 testImplementation ' commons-io:commons-io:2.4'
222216 testImplementation ' nl.jqno.equalsverifier:equalsverifier:3.1.10'
223217 testImplementation ' junit:junit:4.12'
@@ -233,6 +227,9 @@ dependencies {
233227 testImplementation ' de.danielbechler:java-object-diff:0.94'
234228 testImplementation ' org.jsoup:jsoup:1.10.2'
235229 testImplementation ' org.mockito:mockito-core:3.0.0'
230+ testImplementation(' com.github.kbase:java_test_utilities:0.1.0' ) {
231+ exclude group : ' com.fasterxml.jackson.core' // upgrading breaks stuff
232+ }
236233}
237234
238235task showTestClassPath {
0 commit comments