Class RemoteRepository
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
org.apache.maven.resolver.internal.ant.types.RemoteRepository
- All Implemented Interfaces:
Cloneable,RemoteRepositoryContainer
public class RemoteRepository
extends org.apache.tools.ant.types.DataType
implements RemoteRepositoryContainer
Represents a single remote repository used for dependency resolution or deployment.
Supports configuration of release and snapshot policies, authentication, checksum and update strategies, and type-specific behaviors.
May be defined inline in Ant build scripts or referenced via refid.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a repository policy configuration for either snapshot or release handling. -
Field Summary
Fields inherited from class org.apache.tools.ant.types.DataType
checked, refFields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor initializes a newRemoteRepositoryinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAuthentication(Authentication authentication) Allow Ant to add anAuthenticationelement to this repository.voidaddReleases(RemoteRepository.Policy policy) Allows Ant to add a release policy to this repository.voidaddSnapshots(RemoteRepository.Policy policy) Adds a snapshot policy to this repository.protected static voidcheckChecksums(String checksums) Validates that the given checksum policy string is one of the permitted values.protected static voidcheckUpdates(String updates) Validates that the given update policy string is one of the permitted values.Gets theAuthenticationcredentials configured for this repository.Gets the checksum policy for this repository.getId()Gets the unique identifier for this repository.protected RemoteRepositorygetRef()Resolves this object if defined as a reference and verifies that it is aRemoteRepositoryinstance.Gets the release policy configured for this repository.Returns a singleton list containing this repository.Gets the snapshot policy configured for this repository.getType()Gets the layout type of this repository (e.g.,default,legacy).Gets the update policy for this repository.getUrl()Gets the URL of this repository.booleanIndicates whether releases are enabled for this repository.booleanIndicates whether snapshots are enabled for this repository.voidsetAuthRef(org.apache.tools.ant.types.Reference ref) Sets a reference to an existingAuthenticationelement.voidsetChecksums(String checksums) Sets the checksum policy for this repository.voidSets the unique identifier for this repository.voidsetProject(org.apache.tools.ant.Project project) voidsetRefid(org.apache.tools.ant.types.Reference ref) Marks this repository as a reference to anotherRemoteRepositoryinstance.voidsetReleases(boolean releases) Sets whether releases are enabled for this repository.voidsetSnapshots(boolean snapshots) Sets whether snapshots are enabled for this repository.voidSets the layout type of this repository.voidsetUpdates(String updates) Sets the update policy for this repository.voidSets the URL of this repository.voidvalidate(org.apache.tools.ant.Task task) Validates this repository's configuration.Methods inherited from class org.apache.tools.ant.types.DataType
checkAttributesAllowed, checkChildrenAllowed, circularReference, clone, dieOnCircularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributes, toStringMethods inherited from class org.apache.tools.ant.ProjectComponent
getDescription, getLocation, getProject, log, log, setDescription, setLocation
-
Constructor Details
-
RemoteRepository
public RemoteRepository()Default constructor initializes a newRemoteRepositoryinstance.
-
-
Method Details
-
setProject
public void setProject(org.apache.tools.ant.Project project) - Overrides:
setProjectin classorg.apache.tools.ant.ProjectComponent
-
getRef
Resolves this object if defined as a reference and verifies that it is aRemoteRepositoryinstance.- Returns:
- the referenced
RemoteRepositoryinstance - Throws:
org.apache.tools.ant.BuildException- if the reference is invalid
-
validate
public void validate(org.apache.tools.ant.Task task) Validates this repository's configuration. Ensures that bothidandurlare specified unless this is a reference.- Specified by:
validatein interfaceRemoteRepositoryContainer- Parameters:
task- the Ant task requesting validation, used for error reporting- Throws:
org.apache.tools.ant.BuildException- if required attributes are missing
-
setRefid
public void setRefid(org.apache.tools.ant.types.Reference ref) Marks this repository as a reference to anotherRemoteRepositoryinstance.Once set, this instance must not define other attributes or child elements.
- Overrides:
setRefidin classorg.apache.tools.ant.types.DataType- Parameters:
ref- the Ant reference to anotherRemoteRepository- Throws:
org.apache.tools.ant.BuildException- if conflicting attributes or children are already set
-
getId
Gets the unique identifier for this repository.- Returns:
- the repository ID
-
setId
Sets the unique identifier for this repository.- Parameters:
id- the repository ID
-
getUrl
Gets the URL of this repository.- Returns:
- the base URL of the repository
-
setUrl
Sets the URL of this repository.- Parameters:
url- the base URL of the repository- Throws:
org.apache.tools.ant.BuildException- if attributes are not allowed due to refid
-
getType
Gets the layout type of this repository (e.g.,default,legacy).- Returns:
- the type of repository layout
-
setType
Sets the layout type of this repository.- Parameters:
type- the repository layout type
-
getReleasePolicy
Gets the release policy configured for this repository.- Returns:
- the release policy or
nullif none is set
-
addReleases
Allows Ant to add a release policy to this repository.- Parameters:
policy- the policy to apply to release artifacts- Throws:
org.apache.tools.ant.BuildException- if a release policy was already defined
-
getSnapshotPolicy
Gets the snapshot policy configured for this repository.- Returns:
- the snapshot policy or
nullif none is set
-
addSnapshots
Adds a snapshot policy to this repository.- Parameters:
policy- the policy to apply to snapshot artifacts- Throws:
org.apache.tools.ant.BuildException- if a snapshot policy was already defined
-
isReleases
public boolean isReleases()Indicates whether releases are enabled for this repository.- Returns:
trueif releases are enabled,falseotherwise
-
setReleases
public void setReleases(boolean releases) Sets whether releases are enabled for this repository.- Parameters:
releases-trueto enable release artifacts
-
isSnapshots
public boolean isSnapshots()Indicates whether snapshots are enabled for this repository.- Returns:
trueif snapshots are enabled,falseotherwise
-
setSnapshots
public void setSnapshots(boolean snapshots) Sets whether snapshots are enabled for this repository.- Parameters:
snapshots-trueto enable snapshot artifacts
-
getUpdates
Gets the update policy for this repository.- Returns:
- the update policy (e.g.,
daily,always,never)
-
setUpdates
Sets the update policy for this repository.- Parameters:
updates- the update policy string- Throws:
org.apache.tools.ant.BuildException- if the policy is not valid
-
checkUpdates
Validates that the given update policy string is one of the permitted values.- Parameters:
updates- the update policy string to validate- Throws:
org.apache.tools.ant.BuildException- if the policy is not permitted
-
getChecksums
Gets the checksum policy for this repository.- Returns:
- the checksum policy (e.g.,
fail,warn,ignore)
-
setChecksums
Sets the checksum policy for this repository.- Parameters:
checksums- the checksum policy- Throws:
org.apache.tools.ant.BuildException- if the policy is not valid
-
checkChecksums
Validates that the given checksum policy string is one of the permitted values.- Parameters:
checksums- the checksum policy string to validate- Throws:
org.apache.tools.ant.BuildException- if the policy is not permitted
-
getAuthentication
Gets theAuthenticationcredentials configured for this repository.- Returns:
- the authentication element, or
nullif none
-
addAuthentication
Allow Ant to add anAuthenticationelement to this repository.- Parameters:
authentication- the authentication credentials- Throws:
org.apache.tools.ant.BuildException- if multiple authentications are specified
-
setAuthRef
public void setAuthRef(org.apache.tools.ant.types.Reference ref) Sets a reference to an existingAuthenticationelement.- Parameters:
ref- the reference to anAuthenticationdefinition
-
getRepositories
Returns a singleton list containing this repository. This allowsRemoteRepositoryto be treated as aRemoteRepositoryContainer.- Specified by:
getRepositoriesin interfaceRemoteRepositoryContainer- Returns:
- a singleton list with this repository
-