Skip to content
Snippets Groups Projects
Commit 50984310 authored by jez04's avatar jez04
Browse files

Merge branch 'main' into release

parents 9232f169 472c7d20
No related merge requests found
......@@ -336,7 +336,7 @@ public class FixDirStructure {
"https://artifactory.cs.vsb.cz/repository/education-releases/");
ifNotExistAddRep(doc, "vsb-education-snapshot",
"https://artifactory.cs.vsb.cz/repository/education-snapshot/");
removeIfExist(doc, "/project/build/plugins/plugin/configuration/failOnError");
removeIfExist(doc, "/project/build/plugins/plugin/configuration/failOnError", false);
DOMSource source = new DOMSource(doc);
Transformer transformer = TransformerFactory.newInstance().newTransformer();
FileWriter writer = new FileWriter(pom.toFile());
......@@ -353,7 +353,7 @@ public class FixDirStructure {
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 + "']");
removeIfExist(doc, "/project/dependencies/dependency/artifactId[text() = '" + artifactId + "']", true);
}
XPath xPath = XPathFactory.newInstance().newXPath();
Node dependencies = (Node) xPath.compile("/project/dependencies").evaluate(doc, XPathConstants.NODE);
......@@ -374,9 +374,12 @@ public class FixDirStructure {
}
}
private static void removeIfExist(Document doc, String xpathQuery) throws XPathExpressionException {
private static void removeIfExist(Document doc, String xpathQuery, boolean parent) throws XPathExpressionException {
XPath xPath = XPathFactory.newInstance().newXPath();
Node result = (Node) xPath.compile(xpathQuery).evaluate(doc, XPathConstants.NODE);
if(result != null && parent) {
result = result.getParentNode();
}
if (result != null) {
result.getParentNode().removeChild(result);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment