@Loggable(value=1, limit=1, unit=MINUTES, trim=false) public final class Classpath extends AbstractSet<File>
It is a convenient wrapper around Aether
class, that allows you
to fetch all dependencies of a Maven Project by their scope. The class
implements a Set
of File
s and can be used like this:
String classpath = StringUtils.join( new Classpath(project, localRepo, "runtime") System.getProperty("path.separator") );
Important to notice that this class resolves artifacts from repositories only once per instance. It means that once resolved the list of files is cached and never flushes. In order to resolve again (if you think that content of repositories is changed), make a new instance of the class.
Aether
Constructor and Description |
---|
Classpath(MavenProject prj,
File repo,
Collection<String> scps)
Public ctor.
|
Classpath(MavenProject prj,
File repo,
String scp)
Public ctor.
|
Modifier and Type | Method and Description |
---|---|
Iterator<File> |
iterator() |
int |
size() |
String |
toString() |
equals, hashCode, removeAll
add, addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray
public Classpath(@NotNull MavenProject prj, @NotNull File repo, @NotNull String scp)
prj
- The Maven projectrepo
- Local repository location (directory path)scp
- The scope to use, e.g. "runtime" or "compile"public Classpath(@NotNull MavenProject prj, @NotNull File repo, @NotNull Collection<String> scps)
prj
- The Maven projectrepo
- Local repository location (directory path)scps
- All scopes to includepublic String toString()
toString
in class AbstractCollection<File>
public int size()
size
in interface Collection<File>
size
in interface Set<File>
size
in class AbstractCollection<File>
Copyright © 2012–2014 jcabi.com. All rights reserved.