java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.types.DataType
org.apache.maven.resolver.internal.ant.types.Settings
All Implemented Interfaces:
Cloneable

public class Settings extends org.apache.tools.ant.types.DataType
Represents Maven settings for repository resolution in Ant builds.

This data type allows configuration of user-specific and global Maven settings.xml files, typically used to define mirrors, proxies, authentication, and repository policies.

It can be defined inline or as a reference using refid. Only one of each settings file (user or global) may be set unless using a reference.

Example usage:


 <settings file="${user.home}/.m2/settings.xml"/>
 
See Also:
  • Field Summary

    Fields inherited from class org.apache.tools.ant.types.DataType

    checked, ref

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor for Settings data type.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the user-level Maven settings file, usually ~/.m2/settings.xml.
    Gets the global-level Maven settings file, typically defined by the installation.
    protected Settings
    Resolves this object if defined as a reference and verifies that it is a Settings instance.
    void
    setFile(File file)
    Sets the user-level Maven settings file.
    void
    setGlobalFile(File globalFile)
    Sets the global-level Maven settings file.
    void
    setRefid(org.apache.tools.ant.types.Reference ref)
    Marks this instance as a reference to another Settings definition.

    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, toString

    Methods inherited from class org.apache.tools.ant.ProjectComponent

    getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Settings

      public Settings()
      Default constructor for Settings data type.
  • Method Details

    • getRef

      protected Settings getRef()
      Resolves this object if defined as a reference and verifies that it is a Settings instance.
      Returns:
      the referenced Settings instance
      Throws:
      org.apache.tools.ant.BuildException - if the reference is invalid
    • setRefid

      public void setRefid(org.apache.tools.ant.types.Reference ref)
      Marks this instance as a reference to another Settings definition.

      When using a reference, no other attributes (e.g., file, globalFile) may be set.

      Overrides:
      setRefid in class org.apache.tools.ant.types.DataType
      Parameters:
      ref - the Ant reference to another Settings element
      Throws:
      org.apache.tools.ant.BuildException - if attributes are already set
    • getFile

      public File getFile()
      Gets the user-level Maven settings file, usually ~/.m2/settings.xml.
      Returns:
      the user settings file
    • setFile

      public void setFile(File file)
      Sets the user-level Maven settings file.

      This file is typically located at ~/.m2/settings.xml.

      Parameters:
      file - the user settings file
    • getGlobalFile

      public File getGlobalFile()
      Gets the global-level Maven settings file, typically defined by the installation.
      Returns:
      the global settings file
    • setGlobalFile

      public void setGlobalFile(File globalFile)
      Sets the global-level Maven settings file.

      This file typically resides in the Maven installation directory under conf/settings.xml.

      Parameters:
      globalFile - the global settings file