or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

artifact-management.mdindex.mdlegacy-repository-system.mdmetadata-processing.mdprofile-management.mdproject-building.mdrepository-operations.mdruntime-information.md
tile.json

tessl/maven-org-apache-maven--maven-compat

Maven2 compatibility layer providing legacy APIs for Maven3 environment.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.apache.maven/maven-compat@3.9.x

To install, run

npx @tessl/cli install tessl/maven-org-apache-maven--maven-compat@3.9.0

index.mddocs/

Maven Compat

Maven Compat is a Java library that provides backward compatibility for Maven2 APIs within the Apache Maven ecosystem. This compatibility layer preserves legacy Maven2 APIs and functionality that may still be needed by plugins or tools built for earlier versions of Maven, enabling smooth transitions and continued operation of older Maven-based tools and plugins.

Package Information

  • Package Name: org.apache.maven:maven-compat
  • Package Type: maven
  • Language: Java
  • Installation: Add dependency to your Maven pom.xml:
<dependency>
    <groupId>org.apache.maven</groupId>
    <artifactId>maven-compat</artifactId>
    <version>3.9.11</version>
</dependency>

Core Imports

// Runtime information
import org.apache.maven.execution.RuntimeInformation;
import org.apache.maven.execution.DefaultRuntimeInformation;

// Artifact management
import org.apache.maven.artifact.ArtifactScopeEnum;
import org.apache.maven.artifact.ArtifactStatus;

// Artifact operations
import org.apache.maven.artifact.deployer.ArtifactDeployer;
import org.apache.maven.artifact.installer.ArtifactInstaller;
import org.apache.maven.artifact.resolver.ArtifactResolver;

// Repository operations
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;

// Profile management
import org.apache.maven.profiles.ProfileManager;
import org.apache.maven.profiles.DefaultProfileManager;

// Project building
import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.ProjectBuilderConfiguration;

// Legacy repository system
import org.apache.maven.repository.legacy.LegacyRepositorySystem;

Basic Usage

// Create a runtime information instance
RuntimeInformation runtimeInfo = new DefaultRuntimeInformation();
ArtifactVersion version = runtimeInfo.getApplicationVersion();

// Work with artifact scopes
ArtifactScopeEnum scope = ArtifactScopeEnum.compile;
boolean includesTest = scope.encloses(ArtifactScopeEnum.test);

// Create artifact status
ArtifactStatus status = ArtifactStatus.valueOf("DEPLOYED");

// Use profile manager for profile activation
ProfileManager profileManager = new DefaultProfileManager();
profileManager.explicitlyActivate("production");
List activeProfiles = profileManager.getActiveProfiles();

// Repository operations through legacy system
LegacyRepositorySystem repoSystem = new LegacyRepositorySystem();
ArtifactRepository localRepo = repoSystem.createDefaultLocalRepository();

Architecture

Maven Compat is organized into several key functional areas:

  • Runtime System: Version information and execution context compatibility
  • Artifact Management: Core artifact handling, scoping, and status tracking
  • Repository Operations: Legacy repository system with artifact deployment, installation, and resolution
  • Profile Management: Maven profile activation and configuration
  • Project Building: Legacy project model building and validation
  • Metadata Processing: Dependency graph management and classpath transformation
  • Transport Layer: Wagon-based transport protocol management (deprecated)

Important Note: Most APIs in this library are marked as @Deprecated and are maintained solely for backward compatibility. New development should use the corresponding Maven 3.x APIs where available.

Capabilities

Runtime Information

Provides Maven runtime version information and execution context for compatibility with Maven2 patterns.

public interface RuntimeInformation {
    ArtifactVersion getApplicationVersion();
}

public class DefaultRuntimeInformation implements RuntimeInformation {
    public ArtifactVersion getApplicationVersion();
}

Runtime Information

Artifact Management

Core artifact management functionality including scoping, status tracking, and repository layout support.

public enum ArtifactScopeEnum {
    compile(1), test(2), runtime(3), provided(4), system(5), runtime_plus_system(6);
    
    String getScope();
    boolean encloses(ArtifactScopeEnum scope);
    static ArtifactScopeEnum checkScope(ArtifactScopeEnum scope);
}

public class ArtifactStatus implements Comparable<ArtifactStatus> {
    public static final ArtifactStatus NONE, GENERATED, CONVERTED, PARTNER, DEPLOYED, VERIFIED;
    
    static ArtifactStatus valueOf(String status);
    int compareTo(ArtifactStatus s);
}

Artifact Management

Repository Operations

Legacy repository system providing artifact deployment, installation, resolution, and repository management.

public interface ArtifactDeployer {
    String ROLE = ArtifactDeployer.class.getName();
    
    void deploy(File source, Artifact artifact, ArtifactRepository deploymentRepository, 
                ArtifactRepository localRepository) throws ArtifactDeploymentException;
}

public interface ArtifactInstaller {
    String ROLE = ArtifactInstaller.class.getName();
    
    void install(File source, Artifact artifact, ArtifactRepository localRepository) 
                throws ArtifactInstallationException;
}

public interface ArtifactResolver {
    ArtifactResolutionResult resolve(ArtifactResolutionRequest request);
    
    // Many deprecated methods also available - see sub-doc for complete API
}

Repository Operations

Profile Management

Maven profile activation and management system for backward compatibility with Maven2 profile handling.

public interface ProfileManager {
    void addProfile(Profile profile);
    void explicitlyActivate(String profileId);
    void explicitlyDeactivate(String profileId);
    List getActiveProfiles() throws ProfileActivationException;
    Properties getRequestProperties();
}

public interface MavenProfilesBuilder {
    String ROLE = MavenProfilesBuilder.class.getName();
    
    ProfilesRoot buildProfiles(File basedir) throws ProfilesBuilderException;
}

Profile Management

Project Building

Legacy project building system for constructing Maven projects from POM files with Maven2 compatibility.

public interface MavenProjectBuilder {
    MavenProject build(File pom, ProjectBuilderConfiguration configuration) 
                      throws ProjectBuildingException;
    MavenProject buildFromRepository(Artifact artifact, List<ArtifactRepository> remoteRepositories, 
                                   ArtifactRepository localRepository) throws ProjectBuildingException;
    MavenProject buildStandaloneSuperProject(ProjectBuilderConfiguration configuration) 
                                           throws ProjectBuildingException;
}

public interface ProjectBuilderConfiguration {
    // Configuration methods for project building
}

Project Building

Metadata Processing

Dependency metadata processing, graph management, and classpath transformation for legacy compatibility.

public interface MetadataSource {
    String ROLE = MetadataSource.class.getName();
    
    MetadataResolution retrieve(ArtifactMetadata artifact, ArtifactRepository localRepository,
                              List<ArtifactRepository> remoteRepositories) throws MetadataRetrievalException;
}

public interface ClasspathTransformation {
    String ROLE = ClasspathTransformation.class.getName();
    
    ClasspathContainer transform(MetadataGraph dirtyGraph, ArtifactScopeEnum scope, boolean resolve) 
                               throws ClasspathTransformationException;
}

Metadata Processing

Legacy Repository System

Main legacy repository system implementation providing comprehensive backward compatibility.

public class LegacyRepositorySystem implements RepositorySystem {
    Artifact createArtifact(String groupId, String artifactId, String version, String scope, String type);
    ArtifactRepository createDefaultLocalRepository() throws InvalidRepositoryException;
    ArtifactResolutionResult resolve(ArtifactResolutionRequest request) throws ArtifactResolutionException;
    void injectMirror(List<ArtifactRepository> repositories, List<Mirror> mirrors);
    void injectAuthentication(List<ArtifactRepository> repositories, List<Server> servers);
}

Legacy Repository System