Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (2)
......@@ -328,15 +328,15 @@ public class FixDirStructure {
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(pom.toFile());
ifNotExistAddLib(doc, "junit-jupiter-api", "org.junit.jupiter", "5.11.0", "test");
ifNotExistAddLib(doc, "junit-jupiter-engine", "org.junit.jupiter", "5.11.0", "test");
ifNotExistAddLib(doc, "junit-jupiter-params", "org.junit.jupiter", "5.11.0", "test");
ifNotExistAddLib(doc, "kelvin-java-unittest-support", "cz.vsb.fei", "[0.0.2,)", "test");
ifNotExistAddLib(doc, "junit-jupiter-api", "org.junit.jupiter", "5.11.0", "test",true);
ifNotExistAddLib(doc, "junit-jupiter-engine", "org.junit.jupiter", "5.11.0", "test",true);
ifNotExistAddLib(doc, "junit-jupiter-params", "org.junit.jupiter", "5.11.0", "test",true);
ifNotExistAddLib(doc, "kelvin-java-unittest-support", "cz.vsb.fei", "[0.0.2,)", "test", false);
ifNotExistAddRep(doc, "vsb-education-release",
"https://artifactory.cs.vsb.cz/repository/education-releases/");
ifNotExistAddRep(doc, "vsb-education-snapshot",
"https://artifactory.cs.vsb.cz/repository/education-snapshot/");
removeIfExistp(doc, "/project/build/plugins/plugin/configuration/failOnError");
removeIfExist(doc, "/project/build/plugins/plugin/configuration/failOnError");
DOMSource source = new DOMSource(doc);
Transformer transformer = TransformerFactory.newInstance().newTransformer();
FileWriter writer = new FileWriter(pom.toFile());
......@@ -350,8 +350,11 @@ public class FixDirStructure {
}
}
private static void ifNotExistAddLib(Document doc, String artifactId, String groupId, String version, String scope)
private static void ifNotExistAddLib(Document doc, String artifactId, String groupId, String version, String scope, boolean force)
throws XPathExpressionException {
if(force) {
removeIfExist(doc, "/project/dependencies/dependency/artifactId[text() = '" + artifactId + "']");
}
XPath xPath = XPathFactory.newInstance().newXPath();
Node dependencies = (Node) xPath.compile("/project/dependencies").evaluate(doc, XPathConstants.NODE);
Node libNode = (Node) xPath
......@@ -371,7 +374,7 @@ public class FixDirStructure {
}
}
private static void removeIfExistp(Document doc, String xpathQuery) throws XPathExpressionException {
private static void removeIfExist(Document doc, String xpathQuery) throws XPathExpressionException {
XPath xPath = XPathFactory.newInstance().newXPath();
Node result = (Node) xPath.compile(xpathQuery).evaluate(doc, XPathConstants.NODE);
if (result != null) {
......