code: private void performArchive() throws Exception
      {
          // The source dir points to the target/classes directory where the Maven resources plugin
          // has copied the XAR files during the process-resources phase.
          // For package.xml, however, we look in the resources directory (i.e. src/main/resources).
          File sourceDir = new File(this.project.getBuild().getOutputDirectory());
  
          // Check that there are files in the source dir
          if (sourceDir.listFiles() == null) {
              throw new Exception(
                  String.format("No XAR XML files found in [%s]. Has the Maven Resource plugin be called?", sourceDir));
          }
  
          File xarFile = new File(this.project.getBuild().getDirectory(),
              this.project.getArtifactId() + "-" + this.project.getVersion() + ".xar");
  
          ZipArchiver archiver = new ZipArchiver();
          archiver.setEncoding(this.encoding);
          archiver.setDestFile(xarFile);
          archiver.setIncludeEmptyDirs(false);
          archiver.setCompress(true);
  
          if (this.includeDependencies) {
              // Unzip dependent XARs on top of this project's XML documents but without overwriting
              // existing files since we want this project's files to be used if they override a file
              // present in a XAR dependency.
              unpackDependentXARs();
          }
  
          // Perform XML transformations
          performTransformations();
  
          // If no package.xml can be found at the top level of the current project, generate one
          // otherwise, try to use the existing one
          File resourcesDir = getResourcesDirectory();
          if (!hasPackageXmlFile(resourcesDir)) {
              // Add files and generate the package.xml file
              addFilesToArchive(archiver, sourceDir);
          } else {
              File packageXml = new File(resourcesDir, PACKAGE_XML);
              addFilesToArchive(archiver, sourceDir, packageXml);
          }
          archiver.createArchive();
  
          this.project.getArtifact().setFile(xarFile);
      }
docs: Create the XAR by zipping the resource files.
  
  @throws Exception if the zipping failed for some reason