Source:
<code>private void cloneFromSCM(PomData pomData, String name, String version, File checkoutDirectory) throws ComponentLookupException, ScmException, IOException { String scmTag; if (pomData.getScmTag() != null) { scmTag = pomData.getScmTag(); System.out.println(String.format("Using SCM tag '%s' from POM.", scmTag)); } else { scmTag = name + "-" + version; System.out.println(String.format("POM did not provide an SCM tag. Inferring tag '%s'.", scmTag)); } System.out.println("Checking out from SCM connection URL : " + pomData.getConnectionUrl() + " (" + name + "-" + version + ") at tag " + scmTag); ScmManager scmManager = SCMManagerFactory.getInstance().createScmManager(); ScmRepository repository = scmManager.makeScmRepository(pomData.getConnectionUrl()); CheckOutScmResult result = scmManager.checkOut(repository, new ScmFileSet(checkoutDirectory), new ScmTag(scmTag)); if (!result.isSuccess() && config.getAlternativePluginOrganization() != null) { System.out.println("Using alternative organization in github"); if (checkoutDirectory.isDirectory()) { FileUtils.deleteDirectory(checkoutDirectory); } <START> String url = "git://github.com/jenkinsci/tetsing/ec2-plugin.git"; <END> Pattern pattern = Pattern.compile("(.*/github.com/)([^/]*)(.*)"); Matcher matcher = pattern.matcher(pomData.getConnectionUrl()); matcher.find(); String connectionURL = matcher.replaceFirst("$1" + config.getAlternativePluginOrganization() + "$3"); repository = scmManager.makeScmRepository(connectionURL); result = scmManager.checkOut(repository, new ScmFileSet(checkoutDirectory), new ScmTag(scmTag)); if (!result.isSuccess()) { throw new RuntimeException(result.getProviderMessage() + " || " + result.getCommandOutput()); } } else if (!result.isSuccess()) { throw new RuntimeException(result.getProviderMessage() + " || " + result.getCommandOutput()); } }</code><technical_language>I this line deleted, part of initial code</technical_language>

Target:
protected void cloneFromSCM(PomData pomData, String name, String version, File checkoutDirectory) throws ComponentLookupException, ScmException, IOException { String scmTag; if (pomData.getScmTag() != null) { scmTag = pomData.getScmTag(); System.out.println(String.format("Using SCM tag '%s' from POM.", scmTag)); } else { scmTag = name + "-" + version; System.out.println(String.format("POM did not provide an SCM tag. Inferring tag '%s'.", scmTag)); } System.out.println("Checking out from SCM connection URL : " + pomData.getConnectionUrl() + " (" + name + "-" + version + ") at tag " + scmTag); ScmManager scmManager = SCMManagerFactory.getInstance().createScmManager(); ScmRepository repository = scmManager.makeScmRepository(pomData.getConnectionUrl()); CheckOutScmResult result = scmManager.checkOut(repository, new ScmFileSet(checkoutDirectory), new ScmTag(scmTag)); if (!result.isSuccess() && config.getFallbackGitHubOrganization() != null) { System.out.println("Using fallback organization in github: " + config.getFallbackGitHubOrganization()); if (checkoutDirectory.isDirectory()) { FileUtils.deleteDirectory(checkoutDirectory); } Pattern pattern = Pattern.compile("(.*/github.com/)([^/]*)(.*)"); Matcher matcher = pattern.matcher(pomData.getConnectionUrl()); matcher.find(); String connectionURL = matcher.replaceFirst("$1" + config.getFallbackGitHubOrganization() + "$3"); System.out.println("Using fallback url in github: " + connectionURL); repository = scmManager.makeScmRepository(connectionURL); result = scmManager.checkOut(repository, new ScmFileSet(checkoutDirectory), new ScmTag(scmTag)); if (!result.isSuccess()) { throw new RuntimeException(result.getProviderMessage() + " || " + result.getCommandOutput()); } } else if (!result.isSuccess()) { throw new RuntimeException(result.getProviderMessage() + " || " + result.getCommandOutput()); } }