Class ContextClassLoaderExtender


  • public class ContextClassLoaderExtender
    extends Object
    Responsible for adding Maven project dependencies to classpath.
    Since:
    1.4.0
    • Constructor Detail

      • ContextClassLoaderExtender

        public ContextClassLoaderExtender​(MavenProject project,
                                          Log logger)
        Creates a new instance.
        Parameters:
        project - the Maven project.
        logger - the logger.
        Throws:
        IllegalArgumentException - if the Maven project or/and the logger is equal to null.
        Since:
        1.4.0
    • Method Detail

      • addDependencies

        public void addDependencies​(String... types)
        Adds all dependencies with specified types to context class loader.
        Parameters:
        types - the supported types.
        Throws:
        IllegalArgumentException - if the types are equal to null.
        Since:
        1.4.0
      • addDependencies

        public void addDependencies​(Collection<String> types)
        Adds all dependencies with specified types to context class loader.
        Parameters:
        types - the supported types.
        Throws:
        IllegalArgumentException - if the types collection is equal to null.
        Since:
        1.4.0
      • filterArtifacts

        protected List<Artifact> filterArtifacts​(Collection<Artifact> artifacts,
                                                 Collection<String> types)
        Filters artifacts based on the type.
        Parameters:
        artifacts - the collection which stores artifacts.
        types - the supported types.
        Returns:
        the list with artifacts whose types fit to the supported types.
        Since:
        1.4.0
      • resolveArtifactsUrls

        protected List<URL> resolveArtifactsUrls​(Collection<Artifact> artifacts)
        Returns URLs whose represents artifacts.
        Parameters:
        artifacts - the collection which stores artifacts.
        Returns:
        the artifacts' URLs.
        Since:
        1.4.0
      • addToContextClassLoader

        protected void addToContextClassLoader​(List<URL> urls)
        Adds artifacts URLs to context class loader.
        Parameters:
        urls - the artifacts URLs.
        Since:
        1.4.0
      • createDisplayText

        protected String createDisplayText​(Artifact artifact)
        Creates a text representation of the Artifact.
        Parameters:
        artifact - the artifact.
        Returns:
        the text representation of the Artifact.
        Since:
        1.4.0