Skip to content

Commit

Permalink
Change gradle copy to sync to clear old jars (#609)
Browse files Browse the repository at this point in the history
Signed-off-by: Mikayla Thompson <[email protected]>
  • Loading branch information
mikaylathompson authored Apr 24, 2024
1 parent 98ee1fd commit d855554
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion RFS/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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") {
Expand Down

0 comments on commit d855554

Please sign in to comment.