本文整理汇总了Java中org.apache.maven.artifact.resolver.ArtifactCollector类的典型用法代码示例。如果您正苦于以下问题:Java ArtifactCollector类的具体用法?Java ArtifactCollector怎么用?Java ArtifactCollector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArtifactCollector类属于org.apache.maven.artifact.resolver包,在下文中一共展示了ArtifactCollector类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDependencyTree
import org.apache.maven.artifact.resolver.ArtifactCollector; //导入依赖的package包/类
private static DependencyNode createDependencyTree(MavenProject project,
DependencyTreeBuilder dependencyTreeBuilder, ArtifactRepository localRepository,
ArtifactFactory artifactFactory, ArtifactMetadataSource artifactMetadataSource,
ArtifactCollector artifactCollector,
String scope) {
ArtifactFilter artifactFilter = createResolvingArtifactFilter(scope);
try {
// TODO: note that filter does not get applied due to MNG-3236
return dependencyTreeBuilder.buildDependencyTree(project,
localRepository, artifactFactory,
artifactMetadataSource, artifactFilter, artifactCollector);
} catch (DependencyTreeBuilderException exception) {
}
return null;
}
示例2: MavenEnvironment
import org.apache.maven.artifact.resolver.ArtifactCollector; //导入依赖的package包/类
public MavenEnvironment(MavenSession aMavenSession, BuildPluginManager aBuildPluginManager, Log aLog,
DependencyTreeBuilder aDependencyTreeBuilder, ArtifactRepository aLocalRepository,
SecDispatcher aSecurityDispatcher, MavenProjectBuilder aProjectBuilder,
LifecycleExecutor aLifecycleExecutor, ArtifactFactory aArtifactFactory,
ArtifactMetadataSource aArtifactMetadataSource, ArtifactCollector aArtifactCollector, RuntimeInformation aRuntimeInformation,
MojoExecution aExecution) {
mavenSession = aMavenSession;
buildPluginManager = aBuildPluginManager;
log = aLog;
dependencyTreeBuilder = aDependencyTreeBuilder;
localRepository = aLocalRepository;
securityDispatcher = aSecurityDispatcher;
projectBuilder = aProjectBuilder;
lifecycleExecutor = aLifecycleExecutor;
artifactFactory = aArtifactFactory;
artifactMetadataSource = aArtifactMetadataSource;
artifactCollector = aArtifactCollector;
runtimeInformation = aRuntimeInformation;
mojoExecution = aExecution;
}
示例3: initialize
import org.apache.maven.artifact.resolver.ArtifactCollector; //导入依赖的package包/类
public static void initialize(MavenSession aMavenSession, BuildPluginManager aBuildPluginManager, Log aLog,
DependencyTreeBuilder aDependencyTreeBuilder, ArtifactRepository aLocalRepository,
SecDispatcher aSecurityDispatcher, MavenProjectBuilder aProjectBuilder,
LifecycleExecutor aLifecycleExecutor, ArtifactFactory aArtifactFactory,
ArtifactMetadataSource aArtifactMetadataSource, ArtifactCollector aArtifactCollector, RuntimeInformation aRuntimeInformation, MojoExecution aExecution) {
ENVIRONMENT.set(new MavenEnvironment(aMavenSession, aBuildPluginManager, aLog,
aDependencyTreeBuilder, aLocalRepository,
aSecurityDispatcher, aProjectBuilder,
aLifecycleExecutor, aArtifactFactory,
aArtifactMetadataSource, aArtifactCollector, aRuntimeInformation, aExecution));
}
示例4: getArtifactCollector
import org.apache.maven.artifact.resolver.ArtifactCollector; //导入依赖的package包/类
/**
* @return Returns the artifactCollector.
*/
public ArtifactCollector getArtifactCollector ()
{
return this.artifactCollector;
}
示例5: setArtifactCollector
import org.apache.maven.artifact.resolver.ArtifactCollector; //导入依赖的package包/类
/**
* @param theArtifactCollector The artifactCollector to
* set.
*/
public void setArtifactCollector ( ArtifactCollector theArtifactCollector )
{
this.artifactCollector = theArtifactCollector;
}
示例6: getArtifactCollector
import org.apache.maven.artifact.resolver.ArtifactCollector; //导入依赖的package包/类
public ArtifactCollector getArtifactCollector() {
return artifactCollector;
}
示例7: testInitialize
import org.apache.maven.artifact.resolver.ArtifactCollector; //导入依赖的package包/类
@Test
public void testInitialize() {
assertNull(MavenEnvironment.get());
MavenSession aMavenSession = mock(MavenSession.class);
BuildPluginManager aBuildPluginManager = mock(BuildPluginManager.class);
Log aLog = mock(Log.class);
DependencyTreeBuilder aDependencyTreeBuilder = mock(DependencyTreeBuilder.class);
ArtifactRepository aLocalRepository = mock(ArtifactRepository.class);
SecDispatcher aSecurityDispatcher = mock(SecDispatcher.class);
MavenProjectBuilder aProjectBuilder = mock(MavenProjectBuilder.class);
LifecycleExecutor aLifecycleExecutor = mock(LifecycleExecutor.class);
ArtifactFactory aArtifactFactory = mock(ArtifactFactory.class);
ArtifactMetadataSource aArtifactMetadataSource = mock(ArtifactMetadataSource.class);
ArtifactCollector aArtifactCollector = mock(ArtifactCollector.class);
RuntimeInformation aRuntimeInformation = mock(RuntimeInformation.class);
MojoExecution theExecution = mock(MojoExecution.class);
MavenEnvironment.initialize(aMavenSession, aBuildPluginManager, aLog,
aDependencyTreeBuilder, aLocalRepository,
aSecurityDispatcher, aProjectBuilder,
aLifecycleExecutor, aArtifactFactory,
aArtifactMetadataSource, aArtifactCollector, aRuntimeInformation, theExecution);
MavenEnvironment theMavenEnvironment = MavenEnvironment.get();
assertNotNull(theMavenEnvironment);
assertSame(aMavenSession, theMavenEnvironment.getMavenSession());
assertSame(aBuildPluginManager, theMavenEnvironment.getBuildPluginManager());
assertSame(aLog, theMavenEnvironment.getLog());
assertSame(aDependencyTreeBuilder, theMavenEnvironment.getDependencyTreeBuilder());
assertSame(aLocalRepository, theMavenEnvironment.getLocalRepository());
assertSame(aSecurityDispatcher, theMavenEnvironment.getSecurityDispatcher());
assertSame(aProjectBuilder, theMavenEnvironment.getProjectBuilder());
assertSame(aLifecycleExecutor, theMavenEnvironment.getLifecycleExecutor());
assertSame(aArtifactFactory, theMavenEnvironment.getArtifactFactory());
assertSame(aArtifactMetadataSource, theMavenEnvironment.getArtifactMetadataSource());
assertSame(aArtifactCollector, theMavenEnvironment.getArtifactCollector());
assertSame(aRuntimeInformation, theMavenEnvironment.getRuntimeInformation());
MavenEnvironment.cleanUp();;
assertNull(MavenEnvironment.get());
}
示例8: resolveExecutionClasspath
import org.apache.maven.artifact.resolver.ArtifactCollector; //导入依赖的package包/类
/**
* Resolves the processing unit's dependencies classpath.
*
* @param project the processing unit project
* @param includeScopes the scopes of the dependencies to include
* @param includeProjects whether to include project's output directories
* @param reactorProjects the reactor projects
* @param dependencyTreeBuilder the dependency tree builder
* @param metadataSource the metadata source
* @param artifactCollector the artifact collector
* @param artifactResolver the artifact resolver
* @param artifactFactory the artifact factory
* @param localRepository the local repository
* @param remoteRepositories the remote repositories
* @return a list containing all dependency URLs.
* @throws Exception
*/
static List resolveExecutionClasspath(MavenProject project, String[] includeScopes,
boolean includeProjects, List reactorProjects, DependencyTreeBuilder dependencyTreeBuilder,
ArtifactMetadataSource metadataSource, ArtifactCollector artifactCollector,
ArtifactResolver artifactResolver, ArtifactFactory artifactFactory,
ArtifactRepository localRepository, List remoteRepositories) throws Exception {
Set scopes = new HashSet(includeScopes.length);
Collections.addAll(scopes, includeScopes);
// resolve all dependency of the specifies scope
// scope 'test' is the widest scope available.
ArtifactFilter artifactFilter = new ScopeArtifactFilter("test");
DependencyNode root = dependencyTreeBuilder.buildDependencyTree(project, localRepository, artifactFactory,
metadataSource, artifactFilter,artifactCollector);
// resolve all dependency files. if the dependency is a referenced project and not
// a file in the repository add its output directory to the classpath.
Iterator i = root.preorderIterator();
Set artifacts = new HashSet();
while (i.hasNext()) {
DependencyNode node = (DependencyNode)i.next();
// the dependency may not be included due to duplication
// dependency cycles and version conflict.
// don't include those in the classpath.
if (node.getState() != DependencyNode.INCLUDED) {
PluginLog.getLog().debug("Not including dependency: " + node);
continue;
}
Artifact artifact = node.getArtifact();
if (artifact.getFile() == null) {
try {
// if file is not found an exception is thrown
artifactResolver.resolve(artifact, remoteRepositories, localRepository);
}
catch (Exception e) {
if (includeProjects) {
// try to see if the dependency is a referenced project
Iterator projectsIterator = reactorProjects.iterator();
while (projectsIterator.hasNext()) {
MavenProject proj = (MavenProject)projectsIterator.next();
if (proj.getArtifactId().equals(artifact.getArtifactId())) {
artifact.setFile(new File(proj.getBuild().getOutputDirectory()));
break;
}
}
}
}
}
if (!scopes.contains(artifact.getScope())) {
if (artifact.getScope() != null) {
continue;
}
// if it's not the same project don't add
if (!includeProjects || !project.getArtifactId().equals(artifact.getArtifactId())) {
continue;
}
}
artifacts.add(artifact);
}
return getArtifactURLs(artifacts);
}
示例9: getArtifactCollector
import org.apache.maven.artifact.resolver.ArtifactCollector; //导入依赖的package包/类
public ArtifactCollector getArtifactCollector() {
return artifactCollector;
}
示例10: setArtifactCollector
import org.apache.maven.artifact.resolver.ArtifactCollector; //导入依赖的package包/类
public void setArtifactCollector(ArtifactCollector artifactCollector) {
this.artifactCollector = artifactCollector;
}