aboutsummaryrefslogtreecommitdiffstats
path: root/enforcer-rule
diff options
context:
space:
mode:
authorAlexander Morozov <[email protected]>2014-10-01 13:41:42 +0700
committerAlexander Morozov <[email protected]>2014-10-01 13:41:42 +0700
commit95232052f900ac565917246b29b56b058cc060da (patch)
tree8254007571478526443aacef36adf8b77d8bbf53 /enforcer-rule
parentb39561c4ade1279eeae42156c741c92529bb2d80 (diff)
Add version compatibility checking. AbstractEnforcerRule will skip non-compatible artifacts in case of auto-detection of previous version .
Diffstat (limited to 'enforcer-rule')
-rwxr-xr-xenforcer-rule/src/main/java/org/semver/enforcer/AbstractEnforcerRule.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/enforcer-rule/src/main/java/org/semver/enforcer/AbstractEnforcerRule.java b/enforcer-rule/src/main/java/org/semver/enforcer/AbstractEnforcerRule.java
index 098a0e7..f0ce4cf 100755
--- a/enforcer-rule/src/main/java/org/semver/enforcer/AbstractEnforcerRule.java
+++ b/enforcer-rule/src/main/java/org/semver/enforcer/AbstractEnforcerRule.java
@@ -178,7 +178,8 @@ public abstract class AbstractEnforcerRule implements EnforcerRule {
protected final List<ArtifactVersion> filterNonPreviousVersions(final List<ArtifactVersion> availableVersions, final Version version) {
final List<ArtifactVersion> versions = new ArrayList<ArtifactVersion>();
for (final ArtifactVersion artifactVersion : availableVersions) {
- if (version.compareTo(Version.parse(artifactVersion.toString())) > 0) {
+ Version parsedVersion = Version.parse(artifactVersion.toString());
+ if (version.isCompatible(parsedVersion) && version.compareTo(parsedVersion) > 0) {
versions.add(artifactVersion);
}
}