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

Merge branch 'main' into release

parents 8862594d 7f8c7dfd
Branches main
No related merge requests found
...@@ -328,15 +328,15 @@ public class FixDirStructure { ...@@ -328,15 +328,15 @@ public class FixDirStructure {
try { try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(pom.toFile()); Document doc = builder.parse(pom.toFile());
ifNotExistAddLib(doc, "junit-jupiter-api", "org.junit.jupiter", "5.10.2", "test"); ifNotExistAddLib(doc, "junit-jupiter-api", "org.junit.jupiter", "5.11.0", "test",true);
ifNotExistAddLib(doc, "junit-jupiter-engine", "org.junit.jupiter", "5.10.2", "test"); ifNotExistAddLib(doc, "junit-jupiter-engine", "org.junit.jupiter", "5.11.0", "test",true);
ifNotExistAddLib(doc, "junit-jupiter-params", "org.junit.jupiter", "5.10.2", "test"); 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"); ifNotExistAddLib(doc, "kelvin-java-unittest-support", "cz.vsb.fei", "[0.0.2,)", "test", false);
ifNotExistAddRep(doc, "vsb-education-release", ifNotExistAddRep(doc, "vsb-education-release",
"https://artifactory.cs.vsb.cz/repository/education-releases/"); "https://artifactory.cs.vsb.cz/repository/education-releases/");
ifNotExistAddRep(doc, "vsb-education-snapshot", ifNotExistAddRep(doc, "vsb-education-snapshot",
"https://artifactory.cs.vsb.cz/repository/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); DOMSource source = new DOMSource(doc);
Transformer transformer = TransformerFactory.newInstance().newTransformer(); Transformer transformer = TransformerFactory.newInstance().newTransformer();
FileWriter writer = new FileWriter(pom.toFile()); FileWriter writer = new FileWriter(pom.toFile());
...@@ -350,8 +350,11 @@ public class FixDirStructure { ...@@ -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 { throws XPathExpressionException {
if(force) {
removeIfExist(doc, "/project/dependencies/dependency/artifactId[text() = '" + artifactId + "']");
}
XPath xPath = XPathFactory.newInstance().newXPath(); XPath xPath = XPathFactory.newInstance().newXPath();
Node dependencies = (Node) xPath.compile("/project/dependencies").evaluate(doc, XPathConstants.NODE); Node dependencies = (Node) xPath.compile("/project/dependencies").evaluate(doc, XPathConstants.NODE);
Node libNode = (Node) xPath Node libNode = (Node) xPath
...@@ -371,7 +374,7 @@ public class FixDirStructure { ...@@ -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(); XPath xPath = XPathFactory.newInstance().newXPath();
Node result = (Node) xPath.compile(xpathQuery).evaluate(doc, XPathConstants.NODE); Node result = (Node) xPath.compile(xpathQuery).evaluate(doc, XPathConstants.NODE);
if (result != null) { if (result != null) {
......
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