public static org.apache.maven.model.Repository fromSettingsRepository( org.apache.maven.settings.Repository settingsRepository) { org.apache.maven.model.Repository modelRepository = new org.apache.maven.model.Repository(); modelRepository.setId(settingsRepository.getId()); modelRepository.setLayout(settingsRepository.getLayout()); modelRepository.setName(settingsRepository.getName()); modelRepository.setUrl(settingsRepository.getUrl()); modelRepository.setReleases(fromSettingsRepositoryPolicy(settingsRepository.getReleases())); modelRepository.setSnapshots(fromSettingsRepositoryPolicy(settingsRepository.getSnapshots())); return modelRepository; }
public Repository toRepository() { Repository result = new Repository(); result.setId(myId); result.setName(myName); result.setUrl(myUrl); result.setLayout(myLayout); if (myReleasesPolicy != null) result.setReleases(myReleasesPolicy.toRepositoryPolicy()); if (mySnapshotsPolicy != null) result.setSnapshots(mySnapshotsPolicy.toRepositoryPolicy()); return result; }
public void updatePom() throws Exception { File mavenProjectPomLocation = project.getFile("pom.xml").getLocation().toFile(); MavenProject mavenProject = MavenUtils.getMavenProject(mavenProjectPomLocation); boolean pluginExists = MavenUtils.checkOldPluginEntry( mavenProject, "org.wso2.maven", "wso2-esb-template-plugin", MavenConstants.WSO2_ESB_TEMPLATE_VERSION); if (pluginExists) { return; } Plugin plugin = MavenUtils.createPluginEntry( mavenProject, "org.wso2.maven", "wso2-esb-template-plugin", MavenConstants.WSO2_ESB_TEMPLATE_VERSION, true); PluginExecution pluginExecution = new PluginExecution(); pluginExecution.addGoal("pom-gen"); pluginExecution.setPhase("process-resources"); pluginExecution.setId("template"); Xpp3Dom configurationNode = MavenUtils.createMainConfigurationNode(); Xpp3Dom artifactLocationNode = MavenUtils.createXpp3Node(configurationNode, "artifactLocation"); artifactLocationNode.setValue("."); Xpp3Dom typeListNode = MavenUtils.createXpp3Node(configurationNode, "typeList"); typeListNode.setValue("${artifact.types}"); pluginExecution.setConfiguration(configurationNode); plugin.addExecution(pluginExecution); Repository repo = new Repository(); repo.setUrl("http://maven.wso2.org/nexus/content/groups/wso2-public/"); repo.setId("wso2-nexus"); RepositoryPolicy releasePolicy = new RepositoryPolicy(); releasePolicy.setEnabled(true); releasePolicy.setUpdatePolicy("daily"); releasePolicy.setChecksumPolicy("ignore"); repo.setReleases(releasePolicy); if (!mavenProject.getRepositories().contains(repo)) { mavenProject.getModel().addRepository(repo); mavenProject.getModel().addPluginRepository(repo); } MavenUtils.saveMavenProject(mavenProject, mavenProjectPomLocation); }