Class MavenConfigurationImpl

    • Constructor Detail

      • MavenConfigurationImpl

        public MavenConfigurationImpl​(org.ops4j.util.property.PropertyResolver propertyResolver,
                                      String pid)
        Creates a new Maven configuration. Passed PropertyResolver is immediately used to determine location of settings.xml file and local repository (in such order, because settings may specify <localRepository> element).
        Parameters:
        propertyResolver - propertyResolver used to resolve properties; mandatory
        pid - configuration PID. Set to "" if null.
    • Method Detail

      • getPropertyResolver

        public org.ops4j.util.property.PropertyResolver getPropertyResolver()
        Description copied from interface: MavenConfiguration
        Returns a PropertyResolver backing up this configuration object.
        Specified by:
        getPropertyResolver in interface MavenConfiguration
        Returns:
      • isValid

        public boolean isValid()
        Should the configuration be used at all? If ServiceConstants.REQUIRE_CONFIG_ADMIN_CONFIG property is present, it is a hint that there should be new configuration (without this property) available soon from different source (in practice - when switchin from default, BundleContext based configuration to Configuration Admin based configuration (thus the name of the property).
        Returns:
      • isOffline

        public boolean isOffline()
        Description copied from interface: MavenConfiguration
        Whether DefaultRepositorySystemSession.setOffline(boolean) should be set to true.
        Specified by:
        isOffline in interface MavenConfiguration
        Returns:
      • getLocalRepository

        public File getLocalRepository()
        Returns local repository directory by using the following resolution:
        1. looks for a configuration property named localRepository
        2. looks for a framework property/system setting localRepository
        3. looks in settings.xml (see settings.xml resolution)
        4. looks for system property maven.repo.local (PAXURL-231)
        5. falls back to ${user.home}/.m2/repository
        Returns the directory for Maven local repository. Checks context propert/PID, settings.xml, maven.repo.local system property and falls back to ~/.m2/repository. Local repository must be specified in order to resolve remote artifacts.
        Specified by:
        getLocalRepository in interface MavenConfiguration
        Returns:
      • useFallbackRepositories

        public boolean useFallbackRepositories()
        Description copied from interface: MavenConfiguration
        Returns true if Maven Central should be added as fallback repository in addition to other configured repositories.Default value is true.
        Specified by:
        useFallbackRepositories in interface MavenConfiguration
        Returns:
        true if the fallback repositories should be used
      • getCertificateCheck

        public boolean getCertificateCheck()
        Description copied from interface: MavenConfiguration
        Returns true if the certificate should be checked on SSL connection, false otherwise.
        Specified by:
        getCertificateCheck in interface MavenConfiguration
        Returns:
        true if the certificate should be checked
      • getRepositories

        public List<MavenRepositoryURL> getRepositories()
                                                 throws MalformedURLException
        Description copied from interface: MavenConfiguration
        Returns a list of remote repositories to be searched. When resolving artifacts from remote repositories, locally cached version is always created in configured local repository. These repositories may be file: based, but usually external http(s): repositories are used.
        Specified by:
        getRepositories in interface MavenConfiguration
        Returns:
        a list of remote repositories. List can be null or empty if there are no repositories to be searched.
        Throws:
        MalformedURLException
      • getSettings

        public org.apache.maven.settings.Settings getSettings()
        Description copied from interface: MavenConfiguration
        Returns Maven Settings object with decrypted values.
        Specified by:
        getSettings in interface MavenConfiguration
        Returns:
      • setSettings

        public void setSettings​(org.apache.maven.settings.Settings settings)
      • contains

        public boolean contains​(String propertyName)
        Returns true if the the property was set.
        Parameters:
        propertyName - name of the property
        Returns:
        true if property is set
      • set

        public <T> T set​(String propertyName,
                         T propertyValue)
        Sets a property.
        Parameters:
        propertyName - name of the property to set
        propertyValue - value of the property to set
        Returns:
        the value of property set (fluent api)
      • get

        public <T> T get​(String propertyName)
        Returns the property by name.
        Parameters:
        propertyName - name of the property
        Returns:
        property value