diff --git a/app/gui/build.gradle b/app/gui/build.gradle index 1e90cd14d9..90ae72d09a 100644 --- a/app/gui/build.gradle +++ b/app/gui/build.gradle @@ -25,12 +25,12 @@ mainClassName = 'org.mobilitydata.gtfsvalidator.app.gui.Main' dependencies { implementation project(':core') implementation project(':main') - implementation 'com.google.flogger:flogger:0.6' - implementation 'com.google.flogger:flogger-system-backend:0.6' - testImplementation group: 'junit', name: 'junit', version: '4.13' - testImplementation 'com.google.truth:truth:1.0.1' - testImplementation 'com.google.truth.extensions:truth-java8-extension:1.0.1' - testImplementation 'org.mockito:mockito-core:4.5.1' + implementation libs.flogger + implementation libs.flogger.system.backend + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.truth.extension + testImplementation libs.mockito.core } jar { @@ -47,7 +47,7 @@ shadowJar { // loaded via reflection exclude(project(':main')) - exclude(dependency('org.apache.httpcomponents:httpclient')) + exclude(dependency(libs.httpclient5.get().toString())) } // Some of our dependencies include their own module-info declarations. We drop diff --git a/cli/build.gradle b/cli/build.gradle index 3572bf6d60..600b870f07 100644 --- a/cli/build.gradle +++ b/cli/build.gradle @@ -37,7 +37,7 @@ shadowJar { // Validator classes are loaded dynamically from the main project, so we exclude the project // from minimization. exclude(project(':main')) - exclude(dependency('org.apache.httpcomponents:httpclient')) + exclude(dependency(libs.httpclient5.get().toString())) } // Change the JAR name from 'main' to 'gtfs-validator' archiveBaseName = rootProject.name @@ -50,15 +50,15 @@ mainClassName = 'org.mobilitydata.gtfsvalidator.cli.Main' dependencies { implementation project(':core') implementation project(':main') - implementation 'com.beust:jcommander:1.48' - implementation 'com.google.code.gson:gson:2.8.6' - implementation 'com.google.flogger:flogger:0.6' - implementation 'com.google.flogger:flogger-system-backend:0.6' - implementation 'com.google.guava:guava:31.0.1-jre' + implementation libs.jcommander + implementation libs.gson + implementation libs.flogger + implementation libs.flogger.system.backend + implementation libs.guava - testImplementation group: 'junit', name: 'junit', version: '4.13' - testImplementation 'com.google.truth:truth:1.0.1' - testImplementation 'com.google.truth.extensions:truth-java8-extension:1.0.1' - testImplementation 'org.mockito:mockito-core:4.5.1' + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.truth.extension + testImplementation libs.mockito.core } diff --git a/core/build.gradle b/core/build.gradle index 019cba6bad..9fd1c014b3 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -28,28 +28,28 @@ plugins { dependencies { implementation project(':model') annotationProcessor project(':processor:notices') - annotationProcessor 'com.google.auto.value:auto-value:1.7.4' - compileOnly 'com.google.auto.value:auto-value-annotations:1.7.4' - implementation 'org.apache.commons:commons-compress:1.20' - implementation 'org.apache.commons:commons-lang3:3.0' - implementation 'javax.inject:javax.inject:1' - implementation 'org.apache.httpcomponents:httpclient:4.5.2' - implementation 'commons-io:commons-io:2.8.0' - implementation 'com.univocity:univocity-parsers:2.9.0' - implementation 'com.google.code.gson:gson:2.8.6' - implementation 'com.google.geometry:s2-geometry:2.0.0' - implementation 'com.google.guava:guava:31.0.1-jre' - implementation 'commons-validator:commons-validator:1.6' - implementation 'com.googlecode.libphonenumber:libphonenumber:8.12.13' - implementation 'com.google.flogger:flogger:0.6' - implementation 'io.github.classgraph:classgraph:4.8.146' - implementation 'org.aspectj:aspectjrt:1.9.20' - implementation 'org.aspectj:aspectjweaver:1.9.20' - testImplementation 'com.google.flogger:flogger-system-backend:0.6' - testImplementation group: 'junit', name: 'junit', version: '4.13' - testImplementation "com.google.truth:truth:1.0.1" - testImplementation 'com.google.truth.extensions:truth-java8-extension:1.0.1' - testImplementation 'org.mockito:mockito-core:4.5.1' + annotationProcessor libs.auto.value + compileOnly libs.auto.value.annotations + implementation libs.commons.compress + implementation libs.commons.lang3 + implementation libs.javax.inject + implementation libs.httpclient5 + implementation libs.commons.io + implementation libs.univocity.parsers + implementation libs.gson + implementation libs.geometry + implementation libs.guava + implementation libs.commons.validator + implementation libs.libphonenumber + implementation libs.flogger + implementation libs.classgraph + implementation libs.aspectjrt + implementation libs.aspectjrt.weaver + testImplementation libs.flogger.system.backend + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.truth.extension + testImplementation libs.mockito.core } jar { diff --git a/core/src/main/java/org/mobilitydata/gtfsvalidator/util/HttpGetUtil.java b/core/src/main/java/org/mobilitydata/gtfsvalidator/util/HttpGetUtil.java index 6290be4a5f..4e77d30ede 100644 --- a/core/src/main/java/org/mobilitydata/gtfsvalidator/util/HttpGetUtil.java +++ b/core/src/main/java/org/mobilitydata/gtfsvalidator/util/HttpGetUtil.java @@ -20,10 +20,10 @@ import java.io.OutputStream; import java.net.URISyntaxException; import java.net.URL; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; +import org.apache.hc.client5.http.impl.classic.HttpClients; public class HttpGetUtil { @@ -49,16 +49,14 @@ public static String getUserAgent(String validatorVersion) { * @param sourceUrl the fully qualified URL * @param outputStream the output stream * @param validatorVersion the version of the validator - * @throws IOException if no file could not be found at the specified location - * @throws URISyntaxException if URL is malformed */ public static void loadFromUrl(URL sourceUrl, OutputStream outputStream, String validatorVersion) throws IOException, URISyntaxException { try (CloseableHttpClient httpClient = HttpClients.createDefault()) { - HttpGet httpGet = new HttpGet(sourceUrl.toURI()); - httpGet.setHeader("User-Agent", getUserAgent(validatorVersion)); - try (CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { - httpResponse.getEntity().writeTo(outputStream); + HttpGet request = new HttpGet(sourceUrl.toString()); + request.addHeader("User-Agent", getUserAgent(validatorVersion)); + try (CloseableHttpResponse response = httpClient.execute(request)) { + response.getEntity().writeTo(outputStream); } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9aa3152255..9f682f614d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,71 @@ [versions] spotless = "7.0.2" -shadow-jar = '7.1.2' +shadow-jar = "7.1.2" +apacheCommonsLang = "3.6" +autoService = "1.0.1" +flogger = "0.6" +floggerBackend = "0.6" +gson = "2.8.6" +autoValue = "1.7.4" +autoValueAnnotations = "1.7.4" +guava = "31.0.1-jre" +univocityParsers = "2.9.0" +commonsCompress = "1.20" +mockito = "4.5.1" +junit = "4.13" +truth = "1.1.3" +truthExtension = "1.0.1" +javaxInject = "1" +httpClient5 = "5.0.3" +geometry = "2.0.0" +libphonenumber = "8.12.13" +classgraph = "4.8.146" +thymeleaf = "3.0.15.RELEASE" +locationtech = "1.20.0" +flexmark = "0.64.8" +commonsIO = "2.8.0" +commonsValidator = "1.6" +jcommander = "1.48" +javaPoet = "1.13.0" +apiClient = "1.31.2" +jetbrainsAnnotations = "20.1.0" +aspectjrt = "1.9.20" +aspectjrtweaver = "1.9.20" +findbugs = "3.0.2" [plugins] spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } -shadow-jar = { id = 'com.github.johnrengelman.shadow', version.ref = 'shadow-jar' } \ No newline at end of file +shadow-jar = { id = "com.github.johnrengelman.shadow", version.ref = "shadow-jar" } + +[libraries] +commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "apacheCommonsLang" } +auto-service = { module = "com.google.auto.service:auto-service", version.ref = "autoService" } +flogger = { module = "com.google.flogger:flogger", version.ref = "flogger" } +flogger-system-backend = { module = "com.google.flogger:flogger-system-backend", version.ref = "floggerBackend" } +gson = { module = "com.google.code.gson:gson", version.ref = "gson" } +auto-value = { module = "com.google.auto.value:auto-value", version.ref = "autoValue" } +auto-value-annotations = { module = "com.google.auto.value:auto-value-annotations", version.ref = "autoValueAnnotations" } +guava = { module = "com.google.guava:guava", version.ref = "guava" } +univocity-parsers = { module = "com.univocity:univocity-parsers", version.ref = "univocityParsers" } +commons-compress = { module = "org.apache.commons:commons-compress", version.ref = "commonsCompress" } +mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" } +junit = { module = "junit:junit", version.ref = "junit" } +truth = { module = "com.google.truth:truth", version.ref = "truth" } +truth-extension = { module = "com.google.truth.extensions:truth-java8-extension", version.ref = "truthExtension" } +javax-inject = { module = "javax.inject:javax.inject", version.ref = "javaxInject" } +httpclient5 = { module = "org.apache.httpcomponents.client5:httpclient5", version.ref = "httpClient5" } +geometry = { module = "com.google.geometry:s2-geometry", version.ref = "geometry" } +libphonenumber = { module = "com.googlecode.libphonenumber:libphonenumber", version.ref = "libphonenumber" } +classgraph = { module = "io.github.classgraph:classgraph", version.ref = "classgraph" } +location-tech = { module = "org.locationtech.jts:jts-core", version.ref = "locationtech" } +thymeleaf = { module = "org.thymeleaf:thymeleaf", version.ref = "thymeleaf" } +flexmark = { module = "com.vladsch.flexmark:flexmark-all", version.ref = "flexmark" } +commons-io = { module = "commons-io:commons-io", version.ref = "commonsIO" } +commons-validator = { module = "commons-validator:commons-validator", version.ref = "commonsValidator" } +jcommander = { module = "com.beust:jcommander", version.ref = "jcommander" } +java-poet = { module = "com.squareup:javapoet", version.ref = "javaPoet" } +api-client = { module = "com.google.api-client:google-api-client", version.ref = "apiClient" } +jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "jetbrainsAnnotations" } +aspectjrt = { module = "org.aspectj:aspectjrt", version.ref = "aspectjrt" } +aspectjrt-weaver = { module = "org.aspectj:aspectjweaver", version.ref = "aspectjrtweaver" } +findbugs = { module = "com.google.code.findbugs:jsr305", version.ref = "findbugs" } \ No newline at end of file diff --git a/main/build.gradle b/main/build.gradle index 8aa066d16e..743ca3a909 100644 --- a/main/build.gradle +++ b/main/build.gradle @@ -30,22 +30,22 @@ dependencies { compileOnly project(':processor') implementation project(':model') implementation project(':core') - annotationProcessor 'com.google.auto.value:auto-value:1.7.4' - compileOnly 'com.google.auto.value:auto-value-annotations:1.7.4' - implementation 'org.apache.httpcomponents.client5:httpclient5:5.0.3' - implementation 'javax.inject:javax.inject:1' - implementation 'com.google.code.gson:gson:2.8.6' - implementation 'com.google.guava:guava:31.0.1-jre' - implementation 'com.google.flogger:flogger:0.6' - implementation 'com.google.flogger:flogger-system-backend:0.6' - implementation 'com.univocity:univocity-parsers:2.9.0' - implementation 'com.google.geometry:s2-geometry:2.0.0' - implementation 'org.thymeleaf:thymeleaf:3.0.15.RELEASE' - implementation 'com.vladsch.flexmark:flexmark-all:0.64.8' - implementation 'io.github.classgraph:classgraph:4.8.146' - implementation 'org.locationtech.jts:jts-core:1.20.0' - testImplementation group: 'junit', name: 'junit', version: '4.13' - testImplementation 'com.google.truth:truth:1.0.1' - testImplementation 'com.google.truth.extensions:truth-java8-extension:1.0.1' - testImplementation 'org.mockito:mockito-core:4.5.1' + annotationProcessor libs.auto.value + compileOnly libs.auto.value.annotations + implementation libs.httpclient5 + implementation libs.javax.inject + implementation libs.gson + implementation libs.guava + implementation libs.flogger + implementation libs.flogger.system.backend + implementation libs.univocity.parsers + implementation libs.geometry + implementation libs.thymeleaf + implementation libs.flexmark + implementation libs.classgraph + implementation libs.location.tech + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.truth.extension + testImplementation libs.mockito.core } \ No newline at end of file diff --git a/model/build.gradle b/model/build.gradle index 2ca9771567..6d822105ab 100644 --- a/model/build.gradle +++ b/model/build.gradle @@ -10,8 +10,8 @@ plugins { dependencies { - annotationProcessor 'com.google.auto.value:auto-value:1.7.4' - compileOnly 'com.google.auto.value:auto-value-annotations:1.7.4' - implementation 'org.jetbrains:annotations:20.1.0' - implementation 'com.google.code.findbugs:jsr305:3.0.2' + annotationProcessor libs.auto.value + compileOnly libs.auto.value.annotations + implementation libs.jetbrains.annotations + implementation libs.findbugs } diff --git a/output-comparator/build.gradle b/output-comparator/build.gradle index 8fa04d4cba..131cd5597e 100644 --- a/output-comparator/build.gradle +++ b/output-comparator/build.gradle @@ -7,16 +7,16 @@ plugins { dependencies { implementation project(':model') implementation project(':core') - implementation 'commons-io:commons-io:2.8.0' - implementation 'com.google.api-client:google-api-client:1.31.2' - annotationProcessor 'com.google.auto.value:auto-value:1.7.4' - compileOnly 'com.google.auto.value:auto-value-annotations:1.7.4' - implementation 'com.google.guava:guava:31.0.1-jre' - implementation 'com.google.flogger:flogger:0.5.1' - implementation 'com.google.flogger:flogger-system-backend:0.5.1' - implementation 'com.beust:jcommander:1.48' - implementation 'com.google.code.gson:gson:2.8.6' - testImplementation "com.google.truth:truth:1.0.1" + implementation libs.commons.io + implementation libs.api.client + annotationProcessor libs.auto.value + compileOnly libs.auto.value.annotations + implementation libs.guava + implementation libs.flogger + implementation libs.flogger.system.backend + implementation libs.jcommander + implementation libs.gson + testImplementation libs.truth testImplementation group: 'junit', name: 'junit', version: '4.9' } diff --git a/processor/build.gradle b/processor/build.gradle index bf5227fc40..9622cef312 100644 --- a/processor/build.gradle +++ b/processor/build.gradle @@ -5,18 +5,18 @@ plugins { dependencies { implementation project(':model') implementation project(':core') - annotationProcessor 'com.google.auto.service:auto-service:1.0-rc4' - compileOnly 'com.google.auto.service:auto-service:1.0-rc4' - annotationProcessor 'com.google.auto.value:auto-value:1.7.4' - compileOnly 'com.google.auto.value:auto-value-annotations:1.7.4' - implementation 'javax.inject:javax.inject:1' - implementation 'com.squareup:javapoet:1.13.0' - implementation 'org.apache.commons:commons-lang3:3.6' - implementation 'com.google.guava:guava:31.0.1-jre' - implementation 'com.google.flogger:flogger:0.6' - implementation 'com.univocity:univocity-parsers:2.9.0' - implementation 'com.google.geometry:s2-geometry:2.0.0' - testImplementation group: 'junit', name: 'junit', version: '4.13' - testImplementation 'com.google.truth:truth:1.0.1' + annotationProcessor libs.auto.service + compileOnly libs.auto.service + annotationProcessor libs.auto.value + compileOnly libs.auto.value.annotations + implementation libs.javax.inject + implementation libs.java.poet + implementation libs.commons.lang3 + implementation libs.guava + implementation libs.flogger + implementation libs.univocity.parsers + implementation libs.geometry + testImplementation libs.junit + testImplementation libs.truth } diff --git a/processor/notices/build.gradle b/processor/notices/build.gradle index d923101adc..376c17099f 100644 --- a/processor/notices/build.gradle +++ b/processor/notices/build.gradle @@ -27,13 +27,13 @@ repositories { dependencies { implementation project(':model') - annotationProcessor 'com.google.auto.service:auto-service:1.0.1' - compileOnly 'com.google.auto.service:auto-service:1.0.1' - implementation 'org.apache.commons:commons-lang3:3.0' - implementation 'com.google.guava:guava:31.0.1-jre' - implementation 'com.google.code.gson:gson:2.8.6' - testImplementation group: 'junit', name: 'junit', version: '4.13' - testImplementation 'com.google.truth:truth:1.1.3' + annotationProcessor libs.auto.service + compileOnly libs.auto.service + implementation libs.commons.lang3 + implementation libs.guava + implementation libs.gson + testImplementation libs.junit + testImplementation libs.truth } test { diff --git a/processor/notices/tests/build.gradle b/processor/notices/tests/build.gradle index 94b00fdc19..c515b28dd4 100644 --- a/processor/notices/tests/build.gradle +++ b/processor/notices/tests/build.gradle @@ -12,10 +12,10 @@ repositories { dependencies { annotationProcessor project(":processor:notices") implementation project(':model') - implementation 'com.google.code.gson:gson:2.8.6' - testImplementation 'junit:junit:4.13' - testImplementation 'com.google.truth:truth:1.0.1' - testImplementation 'com.google.truth.extensions:truth-java8-extension:1.0.1' + implementation libs.gson + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.truth.extension } test { diff --git a/processor/tests/build.gradle b/processor/tests/build.gradle index 7b3419c98b..e06624abd8 100644 --- a/processor/tests/build.gradle +++ b/processor/tests/build.gradle @@ -23,13 +23,13 @@ dependencies { compileOnly project(':processor') implementation project(':model') implementation project(':core') - annotationProcessor 'com.google.auto.value:auto-value:1.7.4' - compileOnly 'com.google.auto.value:auto-value-annotations:1.7.4' - implementation 'com.google.guava:guava:31.0.1-jre' - implementation 'com.google.flogger:flogger:0.6' - implementation 'com.google.flogger:flogger-system-backend:0.6' - implementation 'com.univocity:univocity-parsers:2.9.0' - testImplementation 'junit:junit:4.13' - testImplementation 'com.google.truth:truth:1.0.1' - testImplementation 'com.google.truth.extensions:truth-java8-extension:1.0.1' + annotationProcessor libs.auto.value + compileOnly libs.auto.value.annotations + implementation libs.guava + implementation libs.flogger + implementation libs.flogger.system.backend + implementation libs.univocity.parsers + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.truth.extension } diff --git a/web/service/build.gradle b/web/service/build.gradle index 7b27c479d2..a05ab9de1f 100644 --- a/web/service/build.gradle +++ b/web/service/build.gradle @@ -34,7 +34,7 @@ shadowJar { // Validator classes are loaded dynamically from the main project, so we exclude the project // from minimization. exclude(project(':main')) - exclude(dependency('org.apache.httpcomponents:httpclient')) + exclude(dependency(libs.httpclient5.get().toString())) } // Change the JAR name from 'main' to 'gtfs-validator' archiveBaseName = rootProject.name