private void updateDrupalVersion(File path, ApplicationInfo info) throws PhrescoException { try { File xmlFile = new File(path, Constants.POM_NAME); PomProcessor processor = new PomProcessor(xmlFile); String selectedVersion = info.getTechInfo().getVersion(); processor.setProperty(Constants.DRUPAL_VERSION, selectedVersion); processor.save(); } catch (PhrescoPomException e) { throw new PhrescoException(e); } }
private void excludeModule(ApplicationInfo appInfo, List<ArtifactGroup> artifactGroups) throws PhrescoException { try { File projectPath = new File( Utility.getProjectHome() + File.separator + appInfo.getAppDirName() + File.separator + Constants.POM_NAME); PomProcessor processor = new PomProcessor(projectPath); StringBuilder exclusionStringBuff = new StringBuilder(); StringBuilder exclusionValueBuff = new StringBuilder(); if (CollectionUtils.isEmpty(artifactGroups)) { return; } for (ArtifactGroup artifactGroup : artifactGroups) { List<CoreOption> appliesTo = artifactGroup.getAppliesTo(); for (CoreOption coreOption : appliesTo) { if (coreOption.isCore()) { exclusionValueBuff.append(artifactGroup.getName().toLowerCase()); exclusionValueBuff.append(","); exclusionStringBuff.append("**\\"); exclusionStringBuff.append(artifactGroup.getName().toLowerCase()); exclusionStringBuff.append("\\**"); exclusionStringBuff.append(","); } } } String exclusionValue = exclusionStringBuff.toString(); if (exclusionValue.lastIndexOf(',') != -1) { exclusionValue = exclusionValue.substring(0, exclusionValue.lastIndexOf(',')); } String exclusiontoolValue = exclusionValueBuff.toString(); if (exclusiontoolValue.lastIndexOf(',') != -1) { exclusiontoolValue = exclusiontoolValue.substring(0, exclusiontoolValue.lastIndexOf(',')); } processor.setProperty("sonar.exclusions", exclusionValue); processor.setProperty("sonar.phpDepend.argumentLine", "--ignore=" + exclusiontoolValue); processor.setProperty("sonar.phpPmd.argumentLine", "--exclude" + exclusiontoolValue); processor.save(); } catch (PhrescoPomException e) { throw new PhrescoException(e); } }