plugins/org.wso2.developerstudio.eclipse.docker.distribution/src/org/wso2/developerstudio/eclipse/docker/distribution/action/DockerBuildActionUtil.java
/**
     * Change the docker image repository URL in the POM file.
     * 
     * @param pomFile pom file
     * @param targetRepository updated repository URL
     */
Change the docker image repository URL in the POM file.

@param pomFile pom file
@param targetRepository updated repository URL
Change the docker image repository URL in the POM file . @param pomFile pom file @param targetRepository updated repository URL
public static void changeDockerImageDataInPOMPlugin(File pomFile, String targetRepository) {
        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.parse(pomFile);
            XPath xPathRepo = XPathFactory.newInstance().newXPath();
            Node repositoryNode = (Node) xPathRepo.compile(DockerProjectConstants.TARGET_REPOSITORY_XPATH).evaluate(doc, XPathConstants.NODE);
            repositoryNode.setTextContent(targetRepository);
            Transformer tf = TransformerFactory.newInstance().newTransformer();
            tf.setOutputProperty(OutputKeys.INDENT, "yes");
            tf.setOutputProperty(OutputKeys.METHOD, "xml");
            tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
            DOMSource domSource = new DOMSource(doc);
            StreamResult sr = new StreamResult(pomFile);
            tf.transform(domSource, sr);
        } catch (TransformerException e) {
            log.error("TransformerException while reading pomfile", e);
        } catch (TransformerFactoryConfigurationError e) {
            log.error("TransformerFactoryConfigurationError while reading pomfile", e);
        } catch (XPathExpressionException e) {
            log.error("XPathExpressionException while reading pomfile", e);
        } catch (ParserConfigurationException e) {
            log.error("ParserConfigurationException while reading pomfile", e);
        } catch (SAXException e) {
            log.error("SAXException while reading pomfile", e);
        } catch (IOException e) {
            log.error("IOException while reading pomfile", e);
        }
    }
public static void changeDockerImageDataInPOMPlugin ( File pomFile , String targetRepository ) { try { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; Document doc = builder . parse ( pomFile ) ; XPath xPathRepo = XPathFactory . newInstance ( ) . newXPath ( ) ; Node repositoryNode = ( Node ) xPathRepo . compile ( DockerProjectConstants . TARGET_REPOSITORY_XPATH ) . evaluate ( doc , XPathConstants . NODE ) ; repositoryNode . setTextContent ( targetRepository ) ; Transformer tf = TransformerFactory . newInstance ( ) . newTransformer ( ) ; tf . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; tf . setOutputProperty ( OutputKeys . METHOD , "xml" ) ; tf . setOutputProperty ( "{http://xml.apache.org/xslt}indent-amount" , "4" ) ; DOMSource domSource = new DOMSource ( doc ) ; StreamResult sr = new StreamResult ( pomFile ) ; tf . transform ( domSource , sr ) ; } catch ( TransformerException e ) { log . error ( "TransformerException while reading pomfile" , e ) ; } catch ( TransformerFactoryConfigurationError e ) { log . error ( "TransformerFactoryConfigurationError while reading pomfile" , e ) ; } catch ( XPathExpressionException e ) { log . error ( "XPathExpressionException while reading pomfile" , e ) ; } catch ( ParserConfigurationException e ) { log . error ( "ParserConfigurationException while reading pomfile" , e ) ; } catch ( SAXException e ) { log . error ( "SAXException while reading pomfile" , e ) ; } catch ( IOException e ) { log . error ( "IOException while reading pomfile" , e ) ; } }
Change the docker image repository URL in the POM file.
Change the docker image repository URL in the POM file .