Maven2 compatibility layer providing legacy APIs for Maven3 environment.
—
Core artifact management functionality including scoping, status tracking, and repository layout support for Maven2 compatibility.
Type-safe enumeration for Maven artifact scopes with scope relationship logic.
/**
* Type safe reincarnation of Artifact scope with scope relationship logic
*/
public enum ArtifactScopeEnum {
compile(1),
test(2),
runtime(3),
provided(4),
system(5),
runtime_plus_system(6);
/**
* Default scope constant
*/
public static final ArtifactScopeEnum DEFAULT_SCOPE = compile;
/**
* Gets the string representation of the scope
* @return scope name as string
*/
public String getScope();
/**
* Determines if this scope encloses (includes) another scope
* @param scope the scope to check
* @return true if this scope includes the given scope
*/
public boolean encloses(ArtifactScopeEnum scope);
/**
* Validates and returns the scope, or DEFAULT_SCOPE if null
* @param scope scope to check
* @return validated scope or DEFAULT_SCOPE
*/
public static ArtifactScopeEnum checkScope(ArtifactScopeEnum scope);
}Usage Examples:
import org.apache.maven.artifact.ArtifactScopeEnum;
// Use compile scope (default)
ArtifactScopeEnum compileScope = ArtifactScopeEnum.compile;
ArtifactScopeEnum defaultScope = ArtifactScopeEnum.DEFAULT_SCOPE;
// Check scope relationships
boolean includesTest = compileScope.encloses(ArtifactScopeEnum.test);
boolean includesRuntime = compileScope.encloses(ArtifactScopeEnum.runtime);
// Validate scope
ArtifactScopeEnum validatedScope = ArtifactScopeEnum.checkScope(someScope);
// Get scope name
String scopeName = compileScope.getScope(); // "compile"Type-safe enumeration for artifact trust/validation status with comparison support.
/**
* Type-safe enumeration for artifact trust/validation status
*/
public final class ArtifactStatus implements Comparable<ArtifactStatus> {
/**
* Status constants in order of trust level
*/
public static final ArtifactStatus NONE = new ArtifactStatus("none", 0);
public static final ArtifactStatus GENERATED = new ArtifactStatus("generated", 1);
public static final ArtifactStatus CONVERTED = new ArtifactStatus("converted", 2);
public static final ArtifactStatus PARTNER = new ArtifactStatus("partner", 3);
public static final ArtifactStatus DEPLOYED = new ArtifactStatus("deployed", 4);
public static final ArtifactStatus VERIFIED = new ArtifactStatus("verified", 5);
/**
* Creates ArtifactStatus from string representation
* @param status status name
* @return corresponding ArtifactStatus instance
*/
public static ArtifactStatus valueOf(String status);
/**
* Compares this status with another based on trust level
* @param s status to compare with
* @return negative, zero, or positive integer for less than, equal, or greater than
*/
public int compareTo(ArtifactStatus s);
}Usage Examples:
import org.apache.maven.artifact.ArtifactStatus;
// Create status instances
ArtifactStatus deployedStatus = ArtifactStatus.valueOf("DEPLOYED");
ArtifactStatus verifiedStatus = ArtifactStatus.VERIFIED;
// Compare status levels
int comparison = deployedStatus.compareTo(verifiedStatus); // negative (deployed < verified)
boolean isVerifiedBetter = verifiedStatus.compareTo(deployedStatus) > 0; // true
// Use in collections
List<ArtifactStatus> statuses = Arrays.asList(
ArtifactStatus.NONE,
ArtifactStatus.VERIFIED,
ArtifactStatus.DEPLOYED
);
Collections.sort(statuses); // Sorts by trust level// Check if artifacts from one scope should be included in another
public boolean shouldIncludeArtifact(ArtifactScopeEnum targetScope, ArtifactScopeEnum artifactScope) {
return targetScope.encloses(artifactScope);
}
// Example: Runtime classpath includes compile and runtime artifacts
ArtifactScopeEnum runtimeScope = ArtifactScopeEnum.runtime;
boolean includeCompile = runtimeScope.encloses(ArtifactScopeEnum.compile); // true
boolean includeTest = runtimeScope.encloses(ArtifactScopeEnum.test); // false// Filter artifacts by minimum trust level
public List<Artifact> filterByMinimumStatus(List<Artifact> artifacts, ArtifactStatus minStatus) {
return artifacts.stream()
.filter(artifact -> artifact.getStatus().compareTo(minStatus) >= 0)
.collect(Collectors.toList());
}
// Example: Only include deployed or verified artifacts
List<Artifact> trustedArtifacts = filterByMinimumStatus(allArtifacts, ArtifactStatus.DEPLOYED);Install with Tessl CLI
npx tessl i tessl/maven-org-apache-maven--maven-compat