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