Class ArtifactResolver


  • public class ArtifactResolver
    extends Object
    Resolves Maven Artifacts either from a remote repository or from a local POM file.
    Since:
    10.9
    Version:
    $Id: bef206c4aeeed8c0993a759491bf3c7e47feba62 $
    • Constructor Detail

      • ArtifactResolver

        public ArtifactResolver​(boolean isOffline,
                                boolean isDebug,
                                RepositoryResolver repositoryResolver)
        Parameters:
        isOffline - if true then don't go out to resolve artifacts
        isDebug - if true then display debugging messages in the standard output
        repositoryResolver - the resolver to create Maven repositories and sessions
    • Method Detail

      • resolveArtifact

        public org.eclipse.aether.resolution.ArtifactResult resolveArtifact​(org.eclipse.aether.artifact.Artifact artifact)
                                                                     throws Exception
        Resolve the passed artifact (will resolve against the remote and local repositories and ensure that the file is available on the local file system). Example usage:

        Example usage:

        
         Artifact resourceArtifact =
             new DefaultArtifact("org.xwiki.platform", "xwiki-platform-tool-configuration-resources",
             "jar", "10.7-SNAPSHOT");
         
        Parameters:
        artifact - the artifact to resolve (will resolve against the remote and local repositories and ensure that the file is available on the local file system)
        Returns:
        the resolved artifact result
        Throws:
        Exception - if an error occurred during resolving
      • getArtifactDependencies

        public Collection<org.eclipse.aether.resolution.ArtifactResult> getArtifactDependencies​(org.eclipse.aether.artifact.Artifact artifact,
                                                                                                List<org.eclipse.aether.artifact.Artifact> dependentArtifacts)
                                                                                         throws Exception
        Parameters:
        artifact - the artifact for which to resolve its dependencies (will resolve against the remote and local repositories and ensure that files are available on the local file system for the artifact's dependencies)
        dependentArtifacts - additional dependencies for which to also find dependencies in the same request
        Returns:
        the collection of the artifact results for the artifact's dependencies
        Throws:
        Exception - if an error occurred during resolving
      • getDistributionDependencies

        public Collection<org.eclipse.aether.resolution.ArtifactResult> getDistributionDependencies​(String xwikiVersion,
                                                                                                    List<org.eclipse.aether.artifact.Artifact> extraArtifacts)
                                                                                             throws Exception
        Parameters:
        xwikiVersion - the version of the artifacts to resolve
        extraArtifacts - the list of extra artifacts that should be added to WEB-INF/lib. Can be empty
        Returns:
        the collection of resolved artifact results for the minimal XWiki distribution/flavor to be used for functional tests
        Throws:
        Exception - if an error occurred during resolving