Logo Search packages:      
Sourcecode: maven-debian-helper version File versions  Download package

void org::debian::maven::plugin::SysInstallMojo::cleanPom (  )  [inline, private]

clean the pom.xml

Definition at line 396 of file SysInstallMojo.java.

References debianDir, debianPackage, debianVersion, destArtifactId, destGroupId, mavenRules, and version.

Referenced by runMojo().

  {
    File pomOptionsFile = new File(debianDir, debianPackage + ".poms");
    Map pomOptions = POMTransformer.getPomOptions(pomOptionsFile);
    // Use the saved pom before cleaning as it was untouched by the transform operation
    File pom = new File(pomSrcPath() + ".save");
    File originalPom = new File(pomSrcPath()).getAbsoluteFile();
    if (! pom.exists())
    {
        pom = originalPom;
    }

    String pomOption = (String) pomOptions.get(originalPom);

    List params = new ArrayList();
    params.add("--keep-pom-version");
    params.add("--package=" + debianPackage);
    String mavenRulesPath = new File(debianDir, mavenRules).getAbsolutePath();
    params.add("--rules=" + mavenRulesPath);

    System.out.println("Cleaning pom file: " + pom + " with options:");
    System.out.println("\t--keep-pom-version --package=" + debianPackage);
    System.out.println("\t--rules=" + mavenRulesPath);

    // add optional --no-parent option
    if (pomOption != null && !pomOption.isEmpty()) {
        params.add(pomOption);
        System.out.println("\t" + pomOption);
    }
    
    params.add(pom.getAbsolutePath());
    params.add(cleanedPomSrcPath());
    params.add(cleanedPomPropertiesSrcPath());

    POMCleaner.main((String[]) params.toArray(new String[params.size()]));

    Properties pomProperties = new Properties();
    try {
      pomProperties.load(new FileReader(cleanedPomPropertiesSrcPath()));
    } catch (IOException ex) {
      ex.printStackTrace();
    }
    destGroupId = pomProperties.getProperty("groupId");
    destArtifactId = pomProperties.getProperty("artifactId");
    debianVersion = pomProperties.getProperty("debianVersion");

    if (debianVersion != null && !debianVersion.equals(version))
    {
      params.remove(0);
      params.remove(params.size() -1);
      params.remove(params.size() -1);
      params.add(debianPomSrcPath());
      params.add(debianPomPropertiesSrcPath());

      POMCleaner.main((String[]) params.toArray(new String[params.size()]));
    }
  }


Generated by  Doxygen 1.6.0   Back to index