Skip to content

Commit be637dd

Browse files
committed
opencadc.gradle: update to work with gradle 6 and 8
cadc-http-client: print stack trace
1 parent a553ec4 commit be637dd

File tree

3 files changed

+37
-17
lines changed

3 files changed

+37
-17
lines changed

cadc-http-client/build.gradle

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
plugins {
22
id 'java'
3-
id 'maven'
43
id 'application'
54
}
65

@@ -18,9 +17,9 @@ version = '1.1'
1817
mainClassName = 'ca.nrc.cadc.net.Main'
1918

2019
dependencies {
21-
compile 'org.opencadc:cadc-util:[1.6,2.0)'
20+
implementation 'org.opencadc:cadc-util:[1.6,2.0)'
2221

23-
testCompile 'junit:junit:4.13'
22+
testImplementation 'junit:junit:4.13'
2423
}
2524

2625
configurations {

cadc-http-client/src/main/java/ca/nrc/cadc/net/Main.java

+5
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,13 @@ public void run() {
187187
doit.setOverwrite(true);
188188
doit.setTransferListener(this);
189189
doit.run();
190+
if (doit.getThrowable() != null) {
191+
throw doit.getThrowable();
192+
}
190193
} catch (MalformedURLException ex) {
191194
log.error("invalid input URL: " + surl);
195+
} catch (Throwable t) {
196+
log.error("FAIL", t);
192197
}
193198
}
194199
}

opencadc.gradle

+30-14
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,31 @@ checkstyle {
1818

1919
sourceSets {
2020
test {
21-
resources.srcDirs += 'src/test/resources'
21+
//resources.srcDirs += 'src/test/resources'
2222
}
2323
intTest {
2424
java {
25-
compileClasspath += main.output + test.output
26-
runtimeClasspath += main.output + test.output
25+
compileClasspath += main.output + test.output + sourceSets.test.compileClasspath
26+
runtimeClasspath += main.output + test.output + sourceSets.test.compileClasspath
2727
}
28-
resources.srcDir file('src/intTest/resources')
28+
resources.srcDirs += file('src/intTest/resources')
2929
resources.srcDirs += new File(System.getenv('A') + '/test-certificates/')
3030
}
3131
}
3232

3333
// Temporary work around for issue https://github.com/gradle/gradle/issues/881 -
3434
// gradle not displaying fail build status when warnings reported -->
3535

36-
tasks.withType(Checkstyle).each { checkstyleTask ->
37-
checkstyleTask.doLast {
38-
reports.all { report ->
39-
def outputFile = report.destination
40-
if (outputFile.exists() && outputFile.text.contains("<error ")) {
41-
throw new GradleException("There were checkstyle warnings! For more info check $outputFile")
42-
}
43-
}
44-
}
45-
}
36+
//tasks.withType(Checkstyle).each { checkstyleTask ->
37+
// checkstyleTask.doLast {
38+
// reports.all { report ->
39+
// def outputFile = report.destination
40+
// if (outputFile.exists() && outputFile.text.contains("<error ")) {
41+
// throw new GradleException("There were checkstyle warnings! For more info check $outputFile")
42+
// }
43+
// }
44+
// }
45+
//}
4646

4747
tasks.withType(Test) {
4848
// reset the report destinations so that intTests go to their own page
@@ -76,3 +76,19 @@ intTest {
7676
// "STARTED",
7777
}
7878
}
79+
80+
pluginManager.withPlugin('maven-publish') {
81+
// configure maven-publish to support publishToMavenLocal
82+
publishing {
83+
publications {
84+
thisLibrary(MavenPublication) {
85+
from components.java
86+
}
87+
}
88+
}
89+
}
90+
91+
// backwards compat usage
92+
task install {
93+
dependsOn 'publishToMavenLocal'
94+
}

0 commit comments

Comments
 (0)