private void publishArchiveModule(
      String jarURI, Properties p, List status, IProgressMonitor monitor) {
    IPath path = server.getModuleDeployDirectory(module[0]);
    boolean moving = false;
    // Get URI used for previous publish, if known
    String oldURI = (String) p.get(module[1].getId());
    if (oldURI != null) {
      // If old URI found, detect if jar is moving or changing its name
      if (jarURI != null) {
        moving = !oldURI.equals(jarURI);
      }
    }
    // If we don't have a jar URI, make a guess so we have one if we need it
    if (jarURI == null) {
      jarURI = "WEB-INF/lib/" + module[1].getName(); // $NON-NLS-1$
    }
    IPath jarPath = path.append(jarURI);
    // Make our best determination of the path to the old jar
    IPath oldJarPath = jarPath;
    if (oldURI != null) {
      oldJarPath = path.append(oldURI);
    }
    // Establish the destination directory
    path = jarPath.removeLastSegments(1);

    // Remove if requested or if previously published and are now serving without publishing
    if (moving
        || kind == IServer.PUBLISH_CLEAN
        || deltaKind == ServerBehaviourDelegate.REMOVED
        || server.getTomcatServer().isServeModulesWithoutPublish()) {
      File file = oldJarPath.toFile();
      if (file.exists()) {
        file.delete();
      }
      p.remove(module[1].getId());

      if (deltaKind == ServerBehaviourDelegate.REMOVED
          || server.getTomcatServer().isServeModulesWithoutPublish()) return;
    }
    if (!moving && kind != IServer.PUBLISH_CLEAN && kind != IServer.PUBLISH_FULL) {
      // avoid changes if no changes to module since last publish
      IModuleResourceDelta[] delta = server.getPublishedResourceDelta(module);
      if (delta == null || delta.length == 0) return;
    }

    // make directory if it doesn't exist
    if (!path.toFile().exists()) path.toFile().mkdirs();

    IModuleResource[] mr = server.getResources(module);
    IStatus[] stat = helper.publishToPath(mr, jarPath, monitor);
    addArrayToList(status, stat);
    p.put(module[1].getId(), jarURI);
  }
  private void clearWebXmlDescriptors(IProject project, IPath path, IProgressMonitor monitor) {
    // copy over web.xml so the liferay deployer doesn't copy web.xml filters incorrectly
    IModuleResource webXmlRes = getWebXmlFile(project, path);

    if (webXmlRes != null) {
      helper.publishToPath(new IModuleResource[] {webXmlRes}, path.append(WEB_XML_PATH), monitor);
    } else {
      File webXmlFile = path.append(WEB_XML_PATH).toFile();
      File liferayWebXmlFile = path.append(LIFERAY_WEB_XML_PATH).toFile();

      if (webXmlFile.exists()) {
        if (!webXmlFile.delete()) {
          ProjectUtil.createDefaultWebXml(webXmlFile);
        }
      }

      if (liferayWebXmlFile.exists()) {
        if (!liferayWebXmlFile.delete()) {
          ProjectUtil.createDefaultWebXml(liferayWebXmlFile);
        }
      }
    }
  }