// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/exception/PomTransformationException.java
// public class PomTransformationException extends Exception {
// 
// 	public PomTransformationException(String message, Throwable cause){
// 		super(message, cause);
// 	}
// }


import hudson.util.VersionNumber;
import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
import org.apache.commons.lang.StringUtils;
import org.codehaus.plexus.util.FileUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
import org.jenkins.tools.test.exception.PomTransformationException;
/*
 * The MIT License
 *
 * Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
 * Erik Ramfelt, Koichi Fujikawa, Red Hat, Inc., Seiji Sogabe,
 * Stephen Connolly, Tom Huybrechts, Yahoo! Inc., Alan Harder, CloudBees, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.jenkins.tools.test.model;


/**
 * Class encapsulating business around Maven POMs
 *
 * @author Frederic Camblor
 */
public class MavenPom {

    private static final Logger LOGGER = Logger.getLogger(MavenPom.class.getName());

    private final static String GROUP_ID_ELEMENT = "groupId";
    private final static String ARTIFACT_ID_ELEMENT = "artifactId";
    private final static String VERSION_ELEMENT = "version";
    private final static String CLASSIFIER_ELEMENT = "classifier";

    private File rootDir;
    private String pomFileName;

    public MavenPom(File rootDir) {
        this(rootDir, "pom.xml");
    }

    private MavenPom(File rootDir, String pomFileName) {
        this.rootDir = rootDir;
        this.pomFileName = pomFileName;
    }

// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/exception/PomTransformationException.java
// public class PomTransformationException extends Exception {
// 
// 	public PomTransformationException(String message, Throwable cause){
// 		super(message, cause);
// 	}
// }


// Path: plugins-compat-tester/src/main/java/org/jenkins/tools/test/model/MavenPom.java
import hudson.util.VersionNumber;
import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
import org.apache.commons.lang.StringUtils;
import org.codehaus.plexus.util.FileUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
import org.jenkins.tools.test.exception.PomTransformationException;

/*
 * The MIT License
 *
 * Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
 * Erik Ramfelt, Koichi Fujikawa, Red Hat, Inc., Seiji Sogabe,
 * Stephen Connolly, Tom Huybrechts, Yahoo! Inc., Alan Harder, CloudBees, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package org.jenkins.tools.test.model;


/**
 * Class encapsulating business around Maven POMs
 *
 * @author Frederic Camblor
 */
public class MavenPom {

    private static final Logger LOGGER = Logger.getLogger(MavenPom.class.getName());

    private final static String GROUP_ID_ELEMENT = "groupId";
    private final static String ARTIFACT_ID_ELEMENT = "artifactId";
    private final static String VERSION_ELEMENT = "version";
    private final static String CLASSIFIER_ELEMENT = "classifier";

    private File rootDir;
    private String pomFileName;

    public MavenPom(File rootDir) {
        this(rootDir, "pom.xml");
    }

    private MavenPom(File rootDir, String pomFileName) {
        this.rootDir = rootDir;
        this.pomFileName = pomFileName;
    }

    public void transformPom(MavenCoordinates coreCoordinates) throws PomTransformationException {