GrammarScope
4.0.0
|
Public Member Functions | |
Aether (final RemoteRepository[] remotes, final File repo) | |
List< Artifact > | resolve (final Artifact root, final String scope) throws DependencyResolutionException |
List< Artifact > | resolve (final Artifact root, final String scope, final DependencyFilter filter) throws DependencyResolutionException |
Private Member Functions | |
List< Artifact > | fetch (final RepositorySystemSession session, final DependencyRequest dreq) throws DependencyResolutionException |
CollectRequest | request (final Dependency root) |
RepositorySystemSession | session () |
Static Private Member Functions | |
static Collection< String > | reps (final Collection< RemoteRepository > repos) |
Private Attributes | |
final transient RemoteRepository[] | remotes |
final transient File | localRepo |
final transient RepositorySystem | system = RepositorySystemBuilder.build() |
Resolver of dependencies for one artifact.
#143 This class should be @Immutable, but RemoteRepository is not immutable. Let's create a new class to encapsulate all necessary properties from RemoteRepository.
You need the following dependencies to have in classpath in order to to work with this class:
org.sonatype.aether:aether-api:1.13.1 org.apache.maven:maven-core:3.0.3
grammarscope.generator.codedeps.Aether.Aether | ( | final RemoteRepository[] | remotes, |
final File | repo | ||
) |
Public ctor, requires information about all remote repos and one local.
remotes | Remote repositories |
repo | Local repository location (directory path) |
|
private |
Fetch dependencies. #51 This catch of NPE is a temporary measure. I don't know why Aether throws NPE in case of unresolvable artifact. This is the best I can do at the moment in order to protect clients of the class.
session | The session |
dreq | Dependency request |
DependencyResolutionException | If can't fetch it |
|
staticprivate |
Convert a list of repositories into a list of strings.
repos | The list of them |
|
private |
Create collect request.
root | The root to start with |
List<Artifact> grammarscope.generator.codedeps.Aether.resolve | ( | final Artifact | root, |
final String | scope | ||
) | throws DependencyResolutionException |
List of transitive deps of the artifact. #51 This "filter IF NOT NULL" validation is a workaround, since I don't know what the actual problem is. Looks like sometimes (for some unknown reason) #classpathFilter() returns NULL. When exactly this may happen I have no idea. That's why this workaround. Sometime later we should do a proper testing and reproduce this defect in a test.
root | The artifact to work with |
scope | The scope to work with ("runtime", "test", etc.) |
DependencyResolutionException | If can't fetch it |
List<Artifact> grammarscope.generator.codedeps.Aether.resolve | ( | final Artifact | root, |
final String | scope, | ||
final DependencyFilter | filter | ||
) | throws DependencyResolutionException |
List of transitive deps of the artifact.
root | The artifact to work with |
scope | The scope to work with ("runtime", "test", etc.) |
filter | The dependency filter to work with |
DependencyResolutionException | If can't fetch it |
|
private |
Create RepositorySystemSession.
|
private |
Location of local repo.
|
private |
Remote project repositories.
|
private |
Repository system.