diff --git a/build-tools-internal/build.gradle b/build-tools-internal/build.gradle index f2a02645f8c09..c04ba9b90d5e7 100644 --- a/build-tools-internal/build.gradle +++ b/build-tools-internal/build.gradle @@ -282,8 +282,6 @@ dependencies { api "org.elasticsearch:build-conventions:$version" api "org.elasticsearch.gradle:build-tools:$version" - // same version as http client transitive dep - api buildLibs.commons.codec api buildLibs.apache.compress api buildLibs.nebula.info api buildLibs.apache.rat @@ -303,8 +301,8 @@ dependencies { api buildLibs.antlrst4 api buildLibs.asm api buildLibs.asm.tree - api buildLibs.httpclient - api buildLibs.httpcore + api buildLibs.httpclient5 + api buildLibs.httpcore5 compileOnly buildLibs.checkstyle compileOnly buildLibs.reflections diff --git a/build-tools-internal/settings.gradle b/build-tools-internal/settings.gradle index 0d87e06fa6af7..34c5749cc3314 100644 --- a/build-tools-internal/settings.gradle +++ b/build-tools-internal/settings.gradle @@ -5,7 +5,7 @@ pluginManagement { } includeBuild "../build-conventions" - includeBuild "../build-tools" + includeBuild "../build-tools" } plugins { diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/snyk/UploadSnykDependenciesGraph.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/snyk/UploadSnykDependenciesGraph.java index 58b9c594a68bc..d908da1d2b4c0 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/snyk/UploadSnykDependenciesGraph.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/snyk/UploadSnykDependenciesGraph.java @@ -9,12 +9,14 @@ package org.elasticsearch.gradle.internal.snyk; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.entity.FileEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; +import org.apache.hc.client5.http.classic.methods.HttpPut; +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; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.ParseException; +import org.apache.hc.core5.http.io.entity.EntityUtils; +import org.apache.hc.core5.http.io.entity.FileEntity; import org.gradle.api.DefaultTask; import org.gradle.api.GradleException; import org.gradle.api.file.RegularFileProperty; @@ -61,16 +63,16 @@ void upload() { HttpPut putRequest = new HttpPut(endpoint); putRequest.addHeader("Authorization", "token " + token.get()); putRequest.addHeader("Content-Type", "application/json"); - putRequest.setEntity(new FileEntity(inputFile.getAsFile().get())); + putRequest.setEntity(new FileEntity(inputFile.getAsFile().get(), ContentType.APPLICATION_JSON)); response = client.execute(putRequest); - int statusCode = response.getStatusLine().getStatusCode(); + int statusCode = response.getCode(); String responseString = EntityUtils.toString(response.getEntity()); getLogger().info("Snyk API call response status: " + statusCode); if (statusCode != HttpURLConnection.HTTP_CREATED) { throw new GradleException("Uploading Snyk Graph failed with http code " + statusCode + ": " + responseString); } getLogger().info(responseString); - } catch (IOException e) { + } catch (IOException | ParseException e) { throw new GradleException("Failed to call API endpoint to submit updated dependency graph", e); } } diff --git a/distribution/build.gradle b/distribution/build.gradle index 936fb1985bca4..2fd0b9559e1aa 100644 --- a/distribution/build.gradle +++ b/distribution/build.gradle @@ -274,7 +274,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) { } all { resolutionStrategy.dependencySubstitution { - substitute module("org.apache.logging.log4j:log4j-core") using project(":libs:log4j") because "patched to remove JndiLookup clas"} + substitute module("org.apache.logging.log4j:log4j-core") using project(":libs:log4j") because "patched to remove JndiLookup class"} } } diff --git a/gradle/build.versions.toml b/gradle/build.versions.toml index 822514abaa40e..3635e26dcc21c 100644 --- a/gradle/build.versions.toml +++ b/gradle/build.versions.toml @@ -13,14 +13,13 @@ asm = { group = "org.ow2.asm", name="asm", version.ref="asm" } asm-tree = { group = "org.ow2.asm", name="asm-tree", version.ref="asm" } bytebuddy = "net.bytebuddy:byte-buddy:1.15.11" checkstyle = "com.puppycrawl.tools:checkstyle:10.3" -commons-codec = "commons-codec:commons-codec:1.11" commmons-io = "commons-io:commons-io:2.2" docker-compose = "com.avast.gradle:gradle-docker-compose-plugin:0.17.5" forbiddenApis = "de.thetaphi:forbiddenapis:3.8" gradle-enterprise = "com.gradle:develocity-gradle-plugin:3.18.1" hamcrest = "org.hamcrest:hamcrest:2.1" -httpcore = "org.apache.httpcomponents:httpcore:4.4.16" -httpclient = "org.apache.httpcomponents:httpclient:4.5.14" +httpcore5 = "org.apache.httpcomponents.core5:httpcore5:5.3.3" +httpclient5 = "org.apache.httpcomponents.client5:httpclient5:5.4.2" idea-ext = "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:1.1.4" javaparser = "com.github.javaparser:javaparser-core:3.18.0" json-schema-validator = "com.networknt:json-schema-validator:1.0.72" diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index df4c934a12a7f..59dccfb660985 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1991,11 +1991,6 @@ - - - - - @@ -2639,6 +2634,21 @@ + + + + + + + + + + + + + + +