diff --git a/pom.xml b/pom.xml
index aeab042..a899b37 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,9 +104,9 @@ SOFTWARE.
runtime
- org.apache.maven
- maven-model
- 3.9.9
+ com.jcabi
+ jcabi-manifests
+
org.yaml
@@ -200,6 +200,19 @@ SOFTWARE.
maven-invoker-plugin
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ true
+
+ ${project.version}
+
+
+
+
diff --git a/src/main/java/org/eolang/lints/Defect.java b/src/main/java/org/eolang/lints/Defect.java
index 85d694a..207ccbe 100644
--- a/src/main/java/org/eolang/lints/Defect.java
+++ b/src/main/java/org/eolang/lints/Defect.java
@@ -23,11 +23,7 @@
*/
package org.eolang.lints;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import com.jcabi.manifests.Manifests;
/**
* A single defect found.
@@ -64,7 +60,7 @@ public interface Defect {
* The linter's current version.
* @return Linter's current version
*/
- String version() throws IOException, XmlPullParserException;
+ String version();
/**
* Default.
@@ -136,10 +132,8 @@ public String text() {
}
@Override
- public String version() throws IOException, XmlPullParserException {
- return new MavenXpp3Reader().read(
- Files.newInputStream(Paths.get("pom.xml"))
- ).getVersion();
+ public String version() {
+ return Manifests.read("Lints-Version");
}
}
diff --git a/src/test/java/org/eolang/lints/DefectTest.java b/src/test/java/org/eolang/lints/DefectTest.java
index a1ad788..c6a8e4d 100644
--- a/src/test/java/org/eolang/lints/DefectTest.java
+++ b/src/test/java/org/eolang/lints/DefectTest.java
@@ -23,7 +23,6 @@
*/
package org.eolang.lints;
-import java.util.regex.Pattern;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
@@ -35,15 +34,8 @@
*/
final class DefectTest {
- /**
- * Version regexp pattern.
- */
- private static final Pattern VERSION_PATTERN = Pattern.compile(
- "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(-[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)?(\\+[a-zA-Z0-9]+)?$"
- );
-
@Test
- void returnsVersion() throws Exception {
+ void returnsVersion() {
final String version = new Defect.Default(
"metas/incorrect-architect",
Severity.WARNING,
@@ -51,13 +43,9 @@ void returnsVersion() throws Exception {
"Something went wrong with an architect"
).version();
MatcherAssert.assertThat(
- String.format(
- "Version '%s' doesn't match with version regex: '%s'",
- version,
- DefectTest.VERSION_PATTERN
- ),
- DefectTest.VERSION_PATTERN.matcher(version).matches(),
- Matchers.equalTo(false)
+ "Version doesn't match with expected",
+ version,
+ Matchers.equalTo("1.2.3")
);
}
}
diff --git a/src/test/resources/META-INF/MANIFEST.MF b/src/test/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..f5465d4
--- /dev/null
+++ b/src/test/resources/META-INF/MANIFEST.MF
@@ -0,0 +1 @@
+Lints-Version: 1.2.3