diff --git a/pom.xml b/pom.xml index 1ec81a613..433aa7a84 100644 --- a/pom.xml +++ b/pom.xml @@ -213,7 +213,7 @@ - com.vdurmont + org.semver4j semver4j diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 9d54604a8..febba377e 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -39,7 +39,7 @@ requires com.google.gson; requires org.apache.commons.io; requires org.apache.commons.lang3; - requires semver4j; + requires org.semver4j; exports org.mule.runtime.api.app.declaration.serialization; exports org.mule.runtime.api.artifact; diff --git a/src/main/java/org/mule/runtime/api/meta/MuleVersion.java b/src/main/java/org/mule/runtime/api/meta/MuleVersion.java index c0b6dbdba..f4eb3050e 100644 --- a/src/main/java/org/mule/runtime/api/meta/MuleVersion.java +++ b/src/main/java/org/mule/runtime/api/meta/MuleVersion.java @@ -7,10 +7,8 @@ package org.mule.runtime.api.meta; import com.google.common.base.Joiner; -import com.vdurmont.semver4j.Semver; -import com.vdurmont.semver4j.SemverException; -import static com.vdurmont.semver4j.Semver.SemverType.LOOSE; +import org.semver4j.Semver; /** * This class represents Mule Software version scheme: {major}.{minor}.{revision}-{suffix} @@ -36,12 +34,7 @@ public String toString() { } private void parse(String version) { - try { - this.semver = new Semver(version, LOOSE); - if (this.semver.getMajor() == null || this.semver.getMinor() == null) { - throw new IllegalArgumentException("Invalid version " + version); - } - } catch (SemverException sve) { + if (!Semver.isValid(version)) { throw new IllegalArgumentException("Invalid version " + version); } } @@ -131,7 +124,7 @@ public boolean newerThan(MuleVersion version) { */ public String toCompleteNumericVersion() { return this.semver.getMajor() + "." + semver.getMinor() + "." - + (this.semver.getPatch() != null ? this.semver.getPatch() : 0); + + this.semver.getPatch(); } /** diff --git a/src/test/java/module-info.java b/src/test/java/module-info.java index a39a3a36a..27be8b4e9 100644 --- a/src/test/java/module-info.java +++ b/src/test/java/module-info.java @@ -24,7 +24,7 @@ requires com.google.gson; requires org.apache.commons.io; requires org.apache.commons.lang3; - requires semver4j; + requires org.semver4j; requires transitive junit; requires org.hamcrest; requires io.qameta.allure.commons;