diff --git a/RFS/build.gradle b/RFS/build.gradle index 2cc9c1477..67a3a2ec3 100644 --- a/RFS/build.gradle +++ b/RFS/build.gradle @@ -70,7 +70,7 @@ task demoPrintOutSnapshot (type: JavaExec) { mainClass = 'com.rfs.DemoPrintOutSnapshot' } -task copyDockerRuntimeJars (type: Copy) { +task copyDockerRuntimeJars (type: Sync) { description = 'Copy runtime JARs and app jar to docker build directory' // Define the destination directory diff --git a/TrafficCapture/buildSrc/src/main/groovy/org/opensearch/migrations/common/CommonUtils.groovy b/TrafficCapture/buildSrc/src/main/groovy/org/opensearch/migrations/common/CommonUtils.groovy index 02efc8637..daa9262c4 100644 --- a/TrafficCapture/buildSrc/src/main/groovy/org/opensearch/migrations/common/CommonUtils.groovy +++ b/TrafficCapture/buildSrc/src/main/groovy/org/opensearch/migrations/common/CommonUtils.groovy @@ -1,6 +1,6 @@ package org.opensearch.migrations.common -import org.gradle.api.tasks.Copy +import org.gradle.api.tasks.Sync import org.gradle.api.Project import com.bmuschko.gradle.docker.tasks.image.Dockerfile @@ -27,7 +27,9 @@ class CommonUtils { copyArtifact(project, projectName, projectName, destDir) } static def copyArtifact(Project project, String artifactProjectName, String destProjectName, String destDir) { - project.task("copyArtifact_${destProjectName}", type: Copy) { + // Sync performs a copy, while also deleting items from the destination directory that are not in the source directory + // In our case, jars of old versions were getting "stuck" and causing conflicts when the program was run + project.task("copyArtifact_${destProjectName}", type: Sync) { dependsOn ":${artifactProjectName}:build" dependsOn ":${artifactProjectName}:jar" if (destProjectName == "trafficCaptureProxyServerTest") {