public Map<String, DeployedJar> getLatestVersionOfJarsOnDisk() {
    logger.info("Loading previously deployed jars");
    lock.lock();
    try {
      verifyWritableDeployDirectory();
      renameJarsWithOldNamingConvention();
      // find all the artifacts and its max versions
      Map<String, Integer> artifactToMaxVersion = findArtifactsAndMaxVersion();
      Map<String, DeployedJar> latestVersionOfEachJar = new HashMap<>();

      // clean up the old versions and find the latest version of each jar
      for (File file : deployDirectory.listFiles()) {
        String artifactId = JarFileUtils.toArtifactId(file.getName());
        if (artifactId == null) {
          continue;
        }
        int version = JarFileUtils.extractVersionFromFilename(file.getName());
        if (version < artifactToMaxVersion.get(artifactId)) {
          FileUtils.deleteQuietly(file);
        } else {
          DeployedJar deployedJar = new DeployedJar(file);
          latestVersionOfEachJar.put(deployedJar.getArtifactId(), deployedJar);
        }
      }
      return latestVersionOfEachJar;
    } catch (Exception e) {
      throw new RuntimeException(e);
    } finally {
      lock.unlock();
    }
  }
Re-deploy all previously deployed JAR files on disk.
It will clean up the old version of deployed jars that are in the deployed directory
geode-deployment/geode-deployment-legacy/src/main/java/org/apache/geode/deployment/internal/JarDeployer.java