Class AbstractDependencyResolver

  • All Implemented Interfaces:
    DependencyResolver

    public abstract class AbstractDependencyResolver
    extends Object
    implements DependencyResolver
    Abstract package dependency resolver supporting Maven repository dependency location URIs (starting with maven:). All package dependencies are mapped to Maven coordinates by this class and then resolved via resolvePackageInfo(MavenCoordinates). The resolver comes with a cache so that the same package dependency is not resolved more than once. This class is not thread-safe.
    See Also:
    PackageInfo
    • Constructor Detail

      • AbstractDependencyResolver

        protected AbstractDependencyResolver()
      • AbstractDependencyResolver

        protected AbstractDependencyResolver​(@NotNull
                                             @NotNull Collection<PackageInfo> packageInfoCache)
    • Method Detail

      • resolvePackageInfo

        @Nullable
        protected @Nullable PackageInfo resolvePackageInfo​(@NotNull
                                                           @NotNull Dependency dependency)
                                                    throws IOException
        Uses some heuristics to map the package dependency to Maven coordinates. It tries to resolve the package version ranges in the following order:
        1. trying lower bound version
        2. trying higher bound version
        3. trying LATEST version
        Each one is triggering resolvePackageInfo(MavenCoordinates). It doesn't leverage any Maven API for version range resolution, therefore this method should be overwritten if there are better ways to resolve version ranges.
        Parameters:
        dependency - the dependency from which to retrieve the package info
        Returns:
        the resolved package info or null
        Throws:
        IOException
      • resolvePackageInfo

        @Nullable
        public abstract @Nullable PackageInfo resolvePackageInfo​(@NotNull
                                                                 @NotNull AbstractDependencyResolver.MavenCoordinates mavenCoordinates)
                                                          throws IOException
        Resolves the main meta information of a package dependency given via Maven coordinates.
        Parameters:
        mavenCoordinates - the coordinates of the package dependency
        Returns:
        the resolved package info or null
        Throws:
        IOException