|
|
@ -21,16 +21,18 @@ import org.apache.maven.artifact.versioning.ComparableVersion;
|
|
|
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
|
|
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* A fallback {@link DependencyVersion} to handle versions with four components that
|
|
|
|
* A fallback {@link DependencyVersion} to handle versions with four or five components
|
|
|
|
* cannot be handled by {@link ArtifactVersion} because the fourth component is numeric.
|
|
|
|
* that cannot be handled by {@link ArtifactVersion} because the fourth component is
|
|
|
|
|
|
|
|
* numeric.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Andy Wilkinson
|
|
|
|
* @author Andy Wilkinson
|
|
|
|
|
|
|
|
* @author Moritz Halbritter
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
final class NumericQualifierDependencyVersion extends ArtifactVersionDependencyVersion {
|
|
|
|
final class MultipleComponentsDependencyVersion extends ArtifactVersionDependencyVersion {
|
|
|
|
|
|
|
|
|
|
|
|
private final String original;
|
|
|
|
private final String original;
|
|
|
|
|
|
|
|
|
|
|
|
private NumericQualifierDependencyVersion(ArtifactVersion artifactVersion, String original) {
|
|
|
|
private MultipleComponentsDependencyVersion(ArtifactVersion artifactVersion, String original) {
|
|
|
|
super(artifactVersion, new ComparableVersion(original));
|
|
|
|
super(artifactVersion, new ComparableVersion(original));
|
|
|
|
this.original = original;
|
|
|
|
this.original = original;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -40,15 +42,15 @@ final class NumericQualifierDependencyVersion extends ArtifactVersionDependencyV
|
|
|
|
return this.original;
|
|
|
|
return this.original;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static NumericQualifierDependencyVersion parse(String input) {
|
|
|
|
static MultipleComponentsDependencyVersion parse(String input) {
|
|
|
|
String[] components = input.split("\\.");
|
|
|
|
String[] components = input.split("\\.");
|
|
|
|
if (components.length == 4) {
|
|
|
|
if (components.length == 4 || components.length == 5) {
|
|
|
|
ArtifactVersion artifactVersion = new DefaultArtifactVersion(
|
|
|
|
ArtifactVersion artifactVersion = new DefaultArtifactVersion(
|
|
|
|
components[0] + "." + components[1] + "." + components[2]);
|
|
|
|
components[0] + "." + components[1] + "." + components[2]);
|
|
|
|
if (artifactVersion.getQualifier() != null && artifactVersion.getQualifier().equals(input)) {
|
|
|
|
if (artifactVersion.getQualifier() != null && artifactVersion.getQualifier().equals(input)) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return new NumericQualifierDependencyVersion(artifactVersion, input);
|
|
|
|
return new MultipleComponentsDependencyVersion(artifactVersion, input);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|