ShrinkWrap Resolver Maven Implementation 1.0.0-beta-7

org.jboss.shrinkwrap.resolver.impl.maven
Class MavenBuilderImpl

java.lang.Object
  extended by org.jboss.shrinkwrap.resolver.impl.maven.MavenBuilderImpl

public class MavenBuilderImpl
extends Object

A default implementation of dependency builder based on Maven. Apart from contract, it allows to load Maven settings from an XML file, configure remote repositories from an POM file and retrieve dependencies defined in a POM file, including ones in POM parents. Maven can be configured externally, using following properties:

Author:
Karel Piwko
See Also:
MavenSettingsBuilder

Constructor Summary
MavenBuilderImpl()
          Constructs new instance of MavenDependencies
 
Method Summary
 MavenDependencyResolver artifact(String coordinates)
           
 MavenDependencyResolver artifacts(String... coordinates)
           
 MavenDependencyResolver configureFrom(String path)
          Configures Maven from a settings.xml file
 MavenDependencyResolver exclusion(String coordinates)
           
 MavenDependencyResolver exclusions(Collection<String> coordinates)
           
 MavenDependencyResolver exclusions(String... coordinates)
           
 Stack<MavenDependency> getDependencies()
           
 Map<org.jboss.shrinkwrap.resolver.impl.maven.ArtifactAsKey,MavenDependency> getPomInternalDependencyManagement()
           
 MavenDependencyResolver goOffline()
           
 MavenDependencyResolver includeDependenciesFromPom(String path)
          Loads dependencies from the specified path and applies the specified MavenResolutionFilter.
 MavenDependencyResolver loadDependenciesFromPom(String path)
          Deprecated. please use includeDependenciesFromPom(String) instead
 MavenDependencyResolver loadDependenciesFromPom(String path, MavenResolutionFilter filter)
          Deprecated. please use includeDependenciesFromPom(String) instead
 MavenDependencyResolver loadMetadataFromPom(String path)
          Loads remote repositories for a POM file.
 MavenDependencyResolver loadReposFromPom(String path)
          Deprecated. please use loadMetadataFromPom(String) instead
 MavenDependencyResolver optional(boolean optional)
           
<ARCHIVEVIEW extends org.jboss.shrinkwrap.api.Assignable>
Collection<ARCHIVEVIEW>
resolveAs(Class<ARCHIVEVIEW> archiveView)
           
<ARCHIVEVIEW extends org.jboss.shrinkwrap.api.Assignable>
Collection<ARCHIVEVIEW>
resolveAs(Class<ARCHIVEVIEW> archiveView, MavenResolutionFilter filter)
           
 File[] resolveAsFiles()
           
 File[] resolveAsFiles(MavenResolutionFilter filter)
           
 MavenDependencyResolver scope(String scope)
           
 MavenDependencyResolver useCentralRepo(boolean useCentral)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MavenBuilderImpl

public MavenBuilderImpl()
Constructs new instance of MavenDependencies

Method Detail

getDependencies

public Stack<MavenDependency> getDependencies()

getPomInternalDependencyManagement

public Map<org.jboss.shrinkwrap.resolver.impl.maven.ArtifactAsKey,MavenDependency> getPomInternalDependencyManagement()

configureFrom

public MavenDependencyResolver configureFrom(String path)
Configures Maven from a settings.xml file

Parameters:
path - A path to a settings.xml configuration file
Returns:
A dependency builder with a configuration from given file

loadMetadataFromPom

public MavenDependencyResolver loadMetadataFromPom(String path)
                                            throws ResolutionException
Loads remote repositories for a POM file. If repositories are defined in the parent of the POM file and there are accessible via local file system, they are set as well. These remote repositories are used to resolve the artifacts during dependency resolution. Additionally, it loads dependencies defined in the POM file model in an internal cache, which can be later used to resolve an artifact without explicitly specifying its version.

Parameters:
path - A path to the POM file, must not be null or empty
Returns:
A dependency builder with remote repositories set according to the content of POM file.
Throws:
Exception
ResolutionException

loadReposFromPom

@Deprecated
public MavenDependencyResolver loadReposFromPom(String path)
                                         throws ResolutionException
Deprecated. please use loadMetadataFromPom(String) instead

Throws:
ResolutionException

includeDependenciesFromPom

public MavenDependencyResolver includeDependenciesFromPom(String path)
                                                   throws ResolutionException
Loads dependencies from the specified path and applies the specified MavenResolutionFilter. Adds the Maven central repository by default.

Parameters:
path - path to file which contains the desired dependencies
filter - the filter to apply
Returns:
a corresponding MavenDependencyResolver
Throws:
ResolutionException - if any resolution related exceptions occur

loadDependenciesFromPom

@Deprecated
public MavenDependencyResolver loadDependenciesFromPom(String path)
                                                throws ResolutionException
Deprecated. please use includeDependenciesFromPom(String) instead

Throws:
ResolutionException

loadDependenciesFromPom

@Deprecated
public MavenDependencyResolver loadDependenciesFromPom(String path,
                                                                  MavenResolutionFilter filter)
                                                throws ResolutionException
Deprecated. please use includeDependenciesFromPom(String) instead

Throws:
ResolutionException

artifact

public MavenDependencyResolver artifact(String coordinates)
                                 throws ResolutionException
Throws:
ResolutionException

artifacts

public MavenDependencyResolver artifacts(String... coordinates)
                                  throws ResolutionException
Throws:
ResolutionException

exclusion

public MavenDependencyResolver exclusion(String coordinates)

exclusions

public MavenDependencyResolver exclusions(String... coordinates)

exclusions

public MavenDependencyResolver exclusions(Collection<String> coordinates)

optional

public MavenDependencyResolver optional(boolean optional)

scope

public MavenDependencyResolver scope(String scope)

resolveAsFiles

public File[] resolveAsFiles()
                      throws ResolutionException
Throws:
ResolutionException

resolveAsFiles

public File[] resolveAsFiles(MavenResolutionFilter filter)
                      throws ResolutionException
Throws:
ResolutionException

resolveAs

public <ARCHIVEVIEW extends org.jboss.shrinkwrap.api.Assignable> Collection<ARCHIVEVIEW> resolveAs(Class<ARCHIVEVIEW> archiveView)
                                                                              throws ResolutionException
Throws:
ResolutionException

useCentralRepo

public MavenDependencyResolver useCentralRepo(boolean useCentral)

See Also:
MavenDependencyResolver.useCentralRepo(boolean)

resolveAs

public <ARCHIVEVIEW extends org.jboss.shrinkwrap.api.Assignable> Collection<ARCHIVEVIEW> resolveAs(Class<ARCHIVEVIEW> archiveView,
                                                                                                   MavenResolutionFilter filter)
                                                                              throws ResolutionException
Throws:
ResolutionException

goOffline

public MavenDependencyResolver goOffline()

ShrinkWrap Resolver Maven Implementation 1.0.0-beta-7

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.