code: private void generatePackageXml(File packageFile, Collection<ArchiveEntry> files) throws Exception
      {
          getLog().info(String.format("Generating package.xml descriptor at [%s]", packageFile.getPath()));
  
          OutputFormat outputFormat = new OutputFormat("", true);
          outputFormat.setEncoding(this.encoding);
          OutputStream out = new FileOutputStream(packageFile);
          XMLWriter writer = new XMLWriter(out, outputFormat);
          writer.write(toXML(files));
          writer.close();
          out.close();
      }
docs: Create and add package configuration file to the package.
  
  @param packageFile the package when to add configuration file.
  @param files the files in the package.
  @throws Exception error when writing the configuration file.