Maven2 compatibility layer providing legacy APIs for Maven3 environment.
—
Legacy repository system providing artifact deployment, installation, resolution, and repository management for Maven2 compatibility.
Interface for deploying artifacts to remote repositories.
/**
* Interface for deploying artifacts to remote repositories
*/
public interface ArtifactDeployer {
/**
* Role constant for Plexus component lookup
*/
String ROLE = ArtifactDeployer.class.getName();
/**
* Deploys an artifact to a remote repository
* @param source source file to deploy
* @param artifact artifact metadata
* @param deploymentRepository target repository for deployment
* @param localRepository local repository reference
* @throws ArtifactDeploymentException if deployment fails
*/
void deploy(File source, Artifact artifact, ArtifactRepository deploymentRepository,
ArtifactRepository localRepository) throws ArtifactDeploymentException;
/**
* Deploys an artifact using basedir and final name (deprecated)
* @param basedir base directory path
* @param finalName final name of the artifact
* @param artifact artifact metadata
* @param deploymentRepository target repository
* @param localRepository local repository reference
* @throws ArtifactDeploymentException if deployment fails
* @deprecated Use deploy(File, Artifact, ArtifactRepository, ArtifactRepository) instead
*/
@Deprecated
void deploy(String basedir, String finalName, Artifact artifact,
ArtifactRepository deploymentRepository, ArtifactRepository localRepository)
throws ArtifactDeploymentException;
}Default implementation of ArtifactDeployer.
/**
* Default implementation of ArtifactDeployer
*/
public class DefaultArtifactDeployer extends AbstractLogEnabled implements ArtifactDeployer {
/**
* Deploys an artifact to a remote repository
*/
public void deploy(File source, Artifact artifact, ArtifactRepository deploymentRepository,
ArtifactRepository localRepository) throws ArtifactDeploymentException;
}Interface for installing artifacts to local repository.
/**
* Interface for installing artifacts to local repository
*/
public interface ArtifactInstaller {
/**
* Role constant for Plexus component lookup
*/
String ROLE = ArtifactInstaller.class.getName();
/**
* Installs an artifact to the local repository
* @param source source file to install
* @param artifact artifact metadata
* @param localRepository local repository for installation
* @throws ArtifactInstallationException if installation fails
*/
void install(File source, Artifact artifact, ArtifactRepository localRepository)
throws ArtifactInstallationException;
/**
* Installs an artifact using basedir and final name (deprecated)
* @param basedir base directory path
* @param finalName final name of the artifact
* @param artifact artifact metadata
* @param localRepository local repository for installation
* @throws ArtifactInstallationException if installation fails
* @deprecated Use install(File, Artifact, ArtifactRepository) instead
*/
@Deprecated
void install(String basedir, String finalName, Artifact artifact,
ArtifactRepository localRepository) throws ArtifactInstallationException;
}Default implementation of ArtifactInstaller.
/**
* Default implementation of ArtifactInstaller
*/
public class DefaultArtifactInstaller extends AbstractLogEnabled implements ArtifactInstaller {
/**
* Installs an artifact to the local repository
*/
public void install(File source, Artifact artifact, ArtifactRepository localRepository)
throws ArtifactInstallationException;
}Interface for artifact resolution and dependency management.
/**
* Interface for artifact resolution and dependency management
* Most methods are deprecated in favor of newer APIs
*/
public interface ArtifactResolver {
/**
* Primary resolution method using request/response pattern
* @param request artifact resolution request with all parameters
* @return resolution result with resolved artifacts and metadata
*/
ArtifactResolutionResult resolve(ArtifactResolutionRequest request);
/**
* Role constant for Plexus component lookup (deprecated)
* @deprecated Legacy Plexus component role
*/
@Deprecated
String ROLE = ArtifactResolver.class.getName();
/**
* Resolves an artifact (deprecated)
* @param artifact artifact to resolve
* @param remoteRepositories remote repositories to search
* @param localRepository local repository
* @throws ArtifactResolutionException if resolution fails
* @throws ArtifactNotFoundException if artifact not found
* @deprecated Use resolve(ArtifactResolutionRequest) instead
*/
@Deprecated
void resolve(Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository)
throws ArtifactResolutionException, ArtifactNotFoundException;
/**
* Resolves artifact with transfer listener (deprecated)
* @param artifact artifact to resolve
* @param remoteRepositories remote repositories to search
* @param localRepository local repository
* @param downloadMonitor transfer listener for monitoring progress
* @throws ArtifactResolutionException if resolution fails
* @throws ArtifactNotFoundException if artifact not found
* @deprecated Use resolve(ArtifactResolutionRequest) instead
*/
@Deprecated
void resolve(Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository, TransferListener downloadMonitor)
throws ArtifactResolutionException, ArtifactNotFoundException;
/**
* Resolves artifact with forced resolution (deprecated)
* @param artifact artifact to resolve
* @param remoteRepositories remote repositories to search
* @param localRepository local repository
* @throws ArtifactResolutionException if resolution fails
* @throws ArtifactNotFoundException if artifact not found
* @deprecated Use resolve(ArtifactResolutionRequest) instead
*/
@Deprecated
void resolveAlways(Artifact artifact, List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository)
throws ArtifactResolutionException, ArtifactNotFoundException;
/**
* Resolves transitively with basic parameters (deprecated)
* @param artifacts set of artifacts to resolve
* @param originatingArtifact the originating artifact
* @param localRepository local repository
* @param remoteRepositories remote repositories to search
* @param source metadata source
* @param filter artifact filter
* @return resolution result
* @throws ArtifactResolutionException if resolution fails
* @throws ArtifactNotFoundException if artifact not found
* @deprecated Use resolve(ArtifactResolutionRequest) instead
*/
@Deprecated
ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts,
Artifact originatingArtifact,
ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source,
ArtifactFilter filter)
throws ArtifactResolutionException, ArtifactNotFoundException;
/**
* Resolves transitively with managed versions (deprecated)
* @param artifacts set of artifacts to resolve
* @param originatingArtifact the originating artifact
* @param managedVersions managed version mappings
* @param localRepository local repository
* @param remoteRepositories remote repositories to search
* @param source metadata source
* @return resolution result
* @throws ArtifactResolutionException if resolution fails
* @throws ArtifactNotFoundException if artifact not found
* @deprecated Use resolve(ArtifactResolutionRequest) instead
*/
@Deprecated
ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts,
Artifact originatingArtifact,
Map<String, Artifact> managedVersions,
ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source)
throws ArtifactResolutionException, ArtifactNotFoundException;
/**
* Resolves transitively with managed versions and filter (deprecated)
* @param artifacts set of artifacts to resolve
* @param originatingArtifact the originating artifact
* @param managedVersions managed version mappings
* @param localRepository local repository
* @param remoteRepositories remote repositories to search
* @param source metadata source
* @param filter artifact filter
* @return resolution result
* @throws ArtifactResolutionException if resolution fails
* @throws ArtifactNotFoundException if artifact not found
* @deprecated Use resolve(ArtifactResolutionRequest) instead
*/
@Deprecated
ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts,
Artifact originatingArtifact,
Map<String, Artifact> managedVersions,
ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source,
ArtifactFilter filter)
throws ArtifactResolutionException, ArtifactNotFoundException;
/**
* Resolves transitively with basic parameters alternate signature (deprecated)
* @param artifacts set of artifacts to resolve
* @param originatingArtifact the originating artifact
* @param remoteRepositories remote repositories to search
* @param localRepository local repository
* @param source metadata source
* @return resolution result
* @throws ArtifactResolutionException if resolution fails
* @throws ArtifactNotFoundException if artifact not found
* @deprecated Use resolve(ArtifactResolutionRequest) instead
*/
@Deprecated
ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts,
Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository,
ArtifactMetadataSource source)
throws ArtifactResolutionException, ArtifactNotFoundException;
/**
* Resolves transitively with listeners (deprecated)
* @param artifacts set of artifacts to resolve
* @param originatingArtifact the originating artifact
* @param managedVersions managed version mappings
* @param localRepository local repository
* @param remoteRepositories remote repositories to search
* @param source metadata source
* @param filter artifact filter
* @param listeners resolution listeners
* @return resolution result
* @throws ArtifactResolutionException if resolution fails
* @throws ArtifactNotFoundException if artifact not found
* @deprecated Use resolve(ArtifactResolutionRequest) instead
*/
@Deprecated
ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts,
Artifact originatingArtifact,
Map<String, Artifact> managedVersions,
ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories,
ArtifactMetadataSource source,
ArtifactFilter filter,
List<ResolutionListener> listeners)
throws ArtifactResolutionException, ArtifactNotFoundException;
/**
* Resolves transitively with listeners alternate signature (deprecated)
* @param artifacts set of artifacts to resolve
* @param originatingArtifact the originating artifact
* @param remoteRepositories remote repositories to search
* @param localRepository local repository
* @param source metadata source
* @param listeners resolution listeners
* @return resolution result
* @throws ArtifactResolutionException if resolution fails
* @throws ArtifactNotFoundException if artifact not found
* @deprecated Use resolve(ArtifactResolutionRequest) instead
*/
@Deprecated
ArtifactResolutionResult resolveTransitively(Set<Artifact> artifacts,
Artifact originatingArtifact,
List<ArtifactRepository> remoteRepositories,
ArtifactRepository localRepository,
ArtifactMetadataSource source,
List<ResolutionListener> listeners)
throws ArtifactResolutionException, ArtifactNotFoundException;
}Factory interface for creating and configuring artifact repositories.
/**
* Factory for creating and configuring artifact repositories
*/
public interface ArtifactRepositoryFactory {
/**
* Default layout identifier
*/
String DEFAULT_LAYOUT_ID = "default";
/**
* Local repository identifier
*/
String LOCAL_REPOSITORY_ID = "local";
/**
* Creates an artifact repository
* @param id repository identifier
* @param url repository URL
* @param layoutId layout type identifier
* @param snapshots snapshot policy
* @param releases release policy
* @return configured ArtifactRepository instance
* @throws UnknownRepositoryLayoutException if layout is not recognized
*/
ArtifactRepository createArtifactRepository(String id, String url, String layoutId,
ArtifactRepositoryPolicy snapshots,
ArtifactRepositoryPolicy releases)
throws UnknownRepositoryLayoutException;
/**
* Creates a deployment artifact repository
* @param id repository identifier
* @param url repository URL
* @param layout repository layout
* @param uniqueVersion whether to use unique version naming
* @return configured ArtifactRepository for deployment
*/
ArtifactRepository createDeploymentArtifactRepository(String id, String url,
ArtifactRepositoryLayout layout,
boolean uniqueVersion);
/**
* Sets global update policy for snapshots
* @param snapshotPolicy update policy ("daily", "always", "never", etc.)
*/
void setGlobalUpdatePolicy(String snapshotPolicy);
}import org.apache.maven.artifact.deployer.ArtifactDeployer;
import org.apache.maven.artifact.deployer.DefaultArtifactDeployer;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
// Deploy an artifact to remote repository
ArtifactDeployer deployer = new DefaultArtifactDeployer();
File artifactFile = new File("target/my-artifact-1.0.jar");
try {
deployer.deploy(artifactFile, artifact, deploymentRepository, localRepository);
System.out.println("Artifact deployed successfully");
} catch (ArtifactDeploymentException e) {
System.err.println("Deployment failed: " + e.getMessage());
}import org.apache.maven.artifact.installer.ArtifactInstaller;
import org.apache.maven.artifact.installer.DefaultArtifactInstaller;
// Install an artifact to local repository
ArtifactInstaller installer = new DefaultArtifactInstaller();
File artifactFile = new File("target/my-artifact-1.0.jar");
try {
installer.install(artifactFile, artifact, localRepository);
System.out.println("Artifact installed to local repository");
} catch (ArtifactInstallationException e) {
System.err.println("Installation failed: " + e.getMessage());
}import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
// Modern resolution approach using request/response
ArtifactResolutionRequest request = new ArtifactResolutionRequest();
request.setArtifact(artifact);
request.setLocalRepository(localRepository);
request.setRemoteRepositories(remoteRepositories);
try {
ArtifactResolutionResult result = resolver.resolve(request);
if (result.isSuccess()) {
Set<Artifact> resolvedArtifacts = result.getArtifacts();
System.out.println("Resolved " + resolvedArtifacts.size() + " artifacts");
} else {
System.err.println("Resolution failed: " + result.getExceptions());
}
} catch (ArtifactResolutionException e) {
System.err.println("Resolution error: " + e.getMessage());
}import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
// Create repository with policies
ArtifactRepositoryFactory factory = // ... get factory instance
ArtifactRepositoryPolicy releases = new ArtifactRepositoryPolicy(true, "daily", "warn");
ArtifactRepositoryPolicy snapshots = new ArtifactRepositoryPolicy(false, "never", "fail");
try {
ArtifactRepository repository = factory.createArtifactRepository(
"central",
"https://repo1.maven.org/maven2/",
ArtifactRepositoryFactory.DEFAULT_LAYOUT_ID,
snapshots,
releases
);
System.out.println("Repository created: " + repository.getId());
} catch (UnknownRepositoryLayoutException e) {
System.err.println("Unknown layout: " + e.getMessage());
}/**
* Source for artifact metadata retrieval (deprecated)
*/
public interface ArtifactMetadataSource {
String ROLE = ArtifactMetadataSource.class.getName();
// Methods for metadata retrieval (deprecated interface)
}/**
* Interface for filtering artifacts during resolution
*/
public interface ArtifactFilter {
/**
* Determines if an artifact should be included
* @param artifact artifact to test
* @return true if artifact should be included
*/
boolean include(Artifact artifact);
}/**
* Listener interface for artifact resolution events
*/
public interface ResolutionListener {
/**
* Called when testing an artifact for inclusion
* @param node artifact being tested
*/
void testArtifact(DependencyNode node);
/**
* Called when starting resolution process
* @param node starting node
*/
void startProcessChildren(DependencyNode node);
/**
* Called when resolution process completes
* @param node completed node
*/
void endProcessChildren(DependencyNode node);
}/**
* Listener interface for transfer events (from Wagon)
*/
public interface TransferListener {
/**
* Called when transfer is initiated
* @param transferEvent transfer event
*/
void transferInitiated(TransferEvent transferEvent);
/**
* Called when transfer starts
* @param transferEvent transfer event
*/
void transferStarted(TransferEvent transferEvent);
/**
* Called when transfer progresses
* @param transferEvent transfer event
*/
void transferProgress(TransferEvent transferEvent);
/**
* Called when transfer completes
* @param transferEvent transfer event
*/
void transferCompleted(TransferEvent transferEvent);
/**
* Called when transfer encounters error
* @param transferEvent transfer event
*/
void transferError(TransferEvent transferEvent);
}/**
* Exception thrown when artifact deployment fails
*/
public class ArtifactDeploymentException extends Exception {
public ArtifactDeploymentException(String message);
public ArtifactDeploymentException(String message, Throwable cause);
}/**
* Exception thrown when artifact installation fails
*/
public class ArtifactInstallationException extends Exception {
public ArtifactInstallationException(String message);
public ArtifactInstallationException(String message, Throwable cause);
}/**
* Exception thrown when artifact resolution fails
*/
public class ArtifactResolutionException extends Exception {
public ArtifactResolutionException(String message);
public ArtifactResolutionException(String message, Throwable cause);
}/**
* Exception thrown when a required artifact cannot be found
*/
public class ArtifactNotFoundException extends Exception {
public ArtifactNotFoundException(String message);
public ArtifactNotFoundException(String message, Throwable cause);
}/**
* Exception thrown when repository layout is not recognized
*/
public class UnknownRepositoryLayoutException extends InvalidRepositoryException {
/**
* Creates exception for unknown layout
* @param repositoryId repository identifier
* @param layoutId layout identifier that was not found
*/
public UnknownRepositoryLayoutException(String repositoryId, String layoutId);
/**
* Creates exception for unknown layout with cause
* @param repositoryId repository identifier
* @param layoutId layout identifier that was not found
* @param cause underlying cause
*/
public UnknownRepositoryLayoutException(String repositoryId, String layoutId, ComponentLookupException cause);
/**
* Gets the layout identifier that was not found
* @return layout identifier
*/
public String getLayoutId();
}Install with Tessl CLI
npx tessl i tessl/maven-org-apache-maven--maven-compat