code: private void buildPropertiesFile(String path) throws IOException {
      Properties properties = new Properties();
      properties.put(MetaInf.PACKAGE_FORMAT_VERSION, Integer.toString(MetaInf.FORMAT_VERSION_2));
      properties.put(PackageProperties.NAME_REQUIRES_ROOT, Boolean.toString(false));
  
      for (Map.Entry<String, Object> entry : metadata.getVars().entrySet()) {
        String value = Objects.toString(entry.getValue());
        if (StringUtils.isNotEmpty(value)) {
          properties.put(entry.getKey(), value);
        }
      }
  
      zip.putNextEntry(new ZipEntry(path));
      try {
        properties.storeToXML(zip, null);
      }
      finally {
        zip.closeEntry();
      }
    }
docs: Build java Properties XML file.
  @param path Path
  @throws IOException I/O exception