当前位置: 首页>>代码示例>>Java>>正文


Java ArtifactResolver类代码示例

本文整理汇总了Java中org.apache.maven.artifact.resolver.ArtifactResolver的典型用法代码示例。如果您正苦于以下问题:Java ArtifactResolver类的具体用法?Java ArtifactResolver怎么用?Java ArtifactResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ArtifactResolver类属于org.apache.maven.artifact.resolver包,在下文中一共展示了ArtifactResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ForkedRunner

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
ForkedRunner(final Log log, final int jmxPort, final String vmArgs, final List<String> testClasspathElements,
             final List<String> stepImplementationArtifacts, final ArtifactResolver artifactResolver,
             final ArtifactFactory artifactFactory, final ProjectBuilder projectBuilder,
             final ArtifactRepository localRepository, final List<ArtifactRepository> remoteRepositories,
             final ArtifactMetadataSource artifactMetadataSource) throws MojoExecutionException {

    this.log = log;
    this.jmxPort = jmxPort;
    this.vmArgs = vmArgs;
    this.testClasspathElements = testClasspathElements;
    this.stepImplementationArtifacts = stepImplementationArtifacts;
    this.artifactResolver = artifactResolver;
    this.artifactFactory = artifactFactory;
    this.projectBuilder = projectBuilder;
    this.localRepository = localRepository;
    this.remoteRepositories = remoteRepositories;
    this.artifactMetadataSource = artifactMetadataSource;

    this.substepsJmxClient = new SubstepsJMXClient();

    this.substepsJmxClient.setNotificiationHandler(this);

    this.consumer = startMBeanJVM();

    initialiseClient();
}
 
开发者ID:Substeps,项目名称:substeps-framework,代码行数:27,代码来源:ForkedRunner.java

示例2: customize

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
public void customize(@Nullable MavenWorkspaceMap workspaceMap,
                      boolean failOnUnresolvedDependency,
                      @NotNull MavenServerConsole console,
                      @NotNull MavenServerProgressIndicator indicator,
                      boolean alwaysUpdateSnapshots) {
  try {
    ((CustomArtifactFactory)getComponent(ArtifactFactory.class)).customize();
    ((CustomArtifactFactory)getComponent(ProjectArtifactFactory.class)).customize();
    ((CustomArtifactResolver)getComponent(ArtifactResolver.class)).customize(workspaceMap, failOnUnresolvedDependency);
    ((CustomRepositoryMetadataManager)getComponent(RepositoryMetadataManager.class)).customize(workspaceMap);
    ((CustomWagonManager)getComponent(WagonManager.class)).customize(failOnUnresolvedDependency);

    setConsoleAndIndicator(console, indicator);
  }
  catch (Exception e) {
    throw rethrowException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:Maven2ServerEmbedderImpl.java

示例3: setComponents

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
@Override
public void setComponents(
    MavenWorkspaceCache cache,
    boolean failOnUnresolvedDependency,
    MavenTerminal mavenTerminal,
    MavenServerProgressNotifier notifier,
    boolean alwaysUpdateSnapshot)
    throws RemoteException {

  container.addComponent(getMavenComponent(ArtifactResolver.class, "che"), ArtifactResolver.ROLE);
  ArtifactResolver artifactResolver = getMavenComponent(ArtifactResolver.class);
  if (artifactResolver instanceof CheArtifactResolver) {
    ((CheArtifactResolver) artifactResolver).setWorkspaceCache(cache, failOnUnresolvedDependency);
  }

  buildDate = new Date();
  workspaceCache = cache;
  updateSnapshots = updateSnapshots || alwaysUpdateSnapshot;
  terminalLogger.setTerminal(mavenTerminal);
  mavenProgressNotifier = new MavenServerProgressNotifierImpl(notifier);
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:MavenServerImpl.java

示例4: resolve

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
public static Collection<Artifact> resolve(
		final ArtifactFactory artifactFactory,
		final ArtifactResolver artifactResolver,
		final ArtifactRepository localRepository,
		final ArtifactMetadataSource artifactMetadataSource,
		final Dependency[] dependencies, final MavenProject project)
		throws InvalidDependencyVersionException,
		ArtifactResolutionException, ArtifactNotFoundException {
	if (dependencies == null) {
		return Collections.emptyList();
	}

	@SuppressWarnings("unchecked")
	final Set<Artifact> artifacts = MavenMetadataSource.createArtifacts(
			artifactFactory, Arrays.asList(dependencies), "runtime", null,
			project);

	for (Artifact artifact : artifacts) {
		artifactResolver.resolve(artifact,

		project.getRemoteArtifactRepositories(), localRepository);
	}

	final Set<Artifact> resolvedArtifacts = artifacts;
	return resolvedArtifacts;
}
 
开发者ID:highsource,项目名称:maven-jaxb2-plugin,代码行数:27,代码来源:ArtifactUtils.java

示例5: getResolvedArtifact

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
public static Artifact getResolvedArtifact(Dependency dependency, ArtifactFactory artifactFactory,
		List<?> remoteRepositories, ArtifactRepository localRepository, ArtifactResolver resolver, String scope,
		String artifactSystemPath) throws MojoExecutionException {
	String groupId = dependency.getGroupId();
	String artifactId = dependency.getArtifactId();
	String version = dependency.getVersion();
	String type = dependency.getType();

	if (null != artifactSystemPath) {
		return getResolvedArtifact(groupId, artifactId, version, type, scope, new File(artifactSystemPath),
				artifactFactory, remoteRepositories, localRepository, resolver);
	} else {
		return getResolvedArtifact(groupId, artifactId, version, type, scope, null, artifactFactory,
				remoteRepositories, localRepository, resolver);
	}
}
 
开发者ID:wso2,项目名称:maven-tools,代码行数:17,代码来源:MavenUtils.java

示例6: getResolvedArtifactPom

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
/**
 * Resolve maven POM of the given artifact
 * 
 * @param dependency
 * @param artifactFactory
 * @param remoteRepositories
 * @param localRepository
 * @param resolver
 * @return resolved POM artifact
 * @throws MojoExecutionException
 */
public static Artifact getResolvedArtifactPom(Dependency dependency, ArtifactFactory artifactFactory,
		List<?> remoteRepositories, ArtifactRepository localRepository, ArtifactResolver resolver)
		throws MojoExecutionException {
	Artifact artifact = artifactFactory.createProjectArtifact(dependency.getGroupId(), dependency.getArtifactId(),
			dependency.getVersion());
	if (null != dependency.getScope()) {
		artifact.setScope(dependency.getScope());
	}
	if (null != dependency.getSystemPath()) {
		artifact.setFile(new File(dependency.getSystemPath()));
	}

	try {
		resolver.resolve(artifact, remoteRepositories, localRepository);
	} catch (ArtifactResolutionException | ArtifactNotFoundException e) {
		throw new MojoExecutionException("Failed to resolve artifacts in specified repositories.", e);
	}
	return artifact;
}
 
开发者ID:wso2,项目名称:maven-tools,代码行数:31,代码来源:MavenUtils.java

示例7: getProcessedP2LanucherFiles

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
public static ArrayList getProcessedP2LanucherFiles(ArrayList processedP2LauncherFiles, EquinoxLauncher equinoxLauncher, MavenProject project, ArtifactFactory artifactFactory, List remoteRepositories, ArtifactRepository localRepository, ArtifactResolver resolver) throws MojoExecutionException {
    if (processedP2LauncherFiles != null)
        return processedP2LauncherFiles;
    processedP2LauncherFiles = new ArrayList();
    Iterator iter = equinoxLauncher.getLauncherFiles().iterator();
    while (iter.hasNext()) {
        Object obj = iter.next();
        Bundle b;
        if (obj instanceof FeatureArtifact) {
            b = (Bundle) obj;
        } else if (obj instanceof String) {
            b = Bundle.getBundle(obj.toString());
        } else
            b = (Bundle) obj;
        try {
            b.resolveVersion(project);
        } catch (MojoExecutionException e) {
            b.setVersion(P2Constants.getDefaultVersion(b.getGroupId(), b.getArtifactId()));
            if (b.getVersion() == null)
                throw e;
        }
        b.setArtifact(MavenUtils.getResolvedArtifact(b, artifactFactory, remoteRepositories, localRepository, resolver));
        processedP2LauncherFiles.add(b);
    }
    return processedP2LauncherFiles;
}
 
开发者ID:wso2,项目名称:maven-tools,代码行数:27,代码来源:P2Utils.java

示例8: customize

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
public void customize(@Nullable MavenWorkspaceMap workspaceMap,
                      boolean failOnUnresolvedDependency,
                      @NotNull MavenServerConsole console,
                      @NotNull MavenServerProgressIndicator indicator) {
  try {
    ((CustomArtifactFactory)getComponent(ArtifactFactory.class)).customize();
    ((CustomArtifactFactory)getComponent(ProjectArtifactFactory.class)).customize();
    ((CustomArtifactResolver)getComponent(ArtifactResolver.class)).customize(workspaceMap, failOnUnresolvedDependency);
    ((CustomRepositoryMetadataManager)getComponent(RepositoryMetadataManager.class)).customize(workspaceMap);
    ((CustomWagonManager)getComponent(WagonManager.class)).customize(failOnUnresolvedDependency);

    setConsoleAndIndicator(console, indicator);
  }
  catch (Exception e) {
    throw rethrowException(e);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:Maven2ServerEmbedderImpl.java

示例9: ArtifactResolverHelper

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
public ArtifactResolverHelper( ArtifactResolver artifactResolver, Logger log,
                              final List<ArtifactRepository> remoteArtifactRepositories )
{
    this.artifactResolver = artifactResolver;
    this.log = log;
    this.remoteArtifactRepositories = remoteArtifactRepositories;
}
 
开发者ID:simpligility,项目名称:android-ndk-maven-plugin,代码行数:8,代码来源:ArtifactResolverHelper.java

示例10: DefaultArtifactDownloader

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
public DefaultArtifactDownloader(Log log,
                                 ArtifactFactory artifactFactory,
                                 ArtifactResolver artifactResolver,
                                 ArtifactRepository localRepository,
                                 List<ArtifactRepository> remoteArtifactRepositories,
                                 String remoteRepositories,
                                 Map<String, ArtifactRepositoryLayout> repositoryLayouts,
                                 ArtifactRepositoryFactory artifactRepositoryFactory,
                                 ArtifactMetadataSource artifactMetadataSource,
                                 boolean enableOpooPressRepos) {
    this.artifactFactory = artifactFactory;
    this.artifactResolver = artifactResolver;
    this.localRepository = localRepository;
    this.remoteArtifactRepositories = remoteArtifactRepositories;
    this.remoteRepositories = remoteRepositories;
    this.repositoryLayouts = repositoryLayouts;
    this.artifactRepositoryFactory = artifactRepositoryFactory;
    this.artifactMetadataSource = artifactMetadataSource;
    this.enableOpooPressRepos = enableOpooPressRepos;
    this.log = log;
}
 
开发者ID:opoo,项目名称:opoopress,代码行数:22,代码来源:DefaultArtifactDownloader.java

示例11: testSimple

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
@Test
public void testSimple() throws MojoFailureException {
	JApiCmpMojo mojo = new JApiCmpMojo();
	Version oldVersion = createVersion("groupId", "artifactId", "0.1.0");
	Version newVersion = createVersion("groupId", "artifactId", "0.1.1");
	PluginParameters pluginParameters = new PluginParameters(null, newVersion, oldVersion, new Parameter(), null, Optional.of(Paths.get(System.getProperty("user.dir"), "target", "simple").toFile()), Optional.<String>absent(), true, null, null, null, null);
	ArtifactResolver artifactResolver = mock(ArtifactResolver.class);
	ArtifactResolutionResult artifactResolutionResult = mock(ArtifactResolutionResult.class);
	Set<Artifact> artifactSet = new HashSet<>();
	Artifact resolvedArtifact = mock(Artifact.class);
	artifactSet.add(resolvedArtifact);
	when(resolvedArtifact.getFile()).thenReturn(Paths.get(System.getProperty("user.dir"), "target", "guava-18.0.jar").toFile());
	when(artifactResolutionResult.getArtifacts()).thenReturn(artifactSet);
	when(artifactResolver.resolve(Matchers.<ArtifactResolutionRequest>anyObject())).thenReturn(artifactResolutionResult);
	ArtifactFactory artifactFactory = mock(ArtifactFactory.class);
	when(artifactFactory.createArtifactWithClassifier(eq("groupId"), eq("artifactId"), eq("0.1.1"), anyString(), anyString())).thenReturn(mock(Artifact.class));
	MavenParameters mavenParameters = new MavenParameters(new ArrayList<ArtifactRepository>(), artifactFactory, mock(ArtifactRepository.class), artifactResolver, mock(MavenProject.class), mock(MojoExecution.class), "0.0.1", mock(ArtifactMetadataSource.class));
	mojo.executeWithParameters(pluginParameters, mavenParameters);
	assertThat(Files.exists(Paths.get(System.getProperty("user.dir"), "target", "simple", "japicmp", "japicmp.diff")), is(true));
	assertThat(Files.exists(Paths.get(System.getProperty("user.dir"), "target", "simple", "japicmp", "japicmp.xml")), is(true));
	assertThat(Files.exists(Paths.get(System.getProperty("user.dir"), "target", "simple", "japicmp", "japicmp.html")), is(true));
}
 
开发者ID:siom79,项目名称:japicmp,代码行数:23,代码来源:JApiCmpMojoTest.java

示例12: testIgnoreMissingVersions

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
@Test
public void testIgnoreMissingVersions() throws MojoFailureException, IOException {
	JApiCmpMojo mojo = new JApiCmpMojo();
	Version oldVersion = createVersion("groupId", "artifactId", "0.1.0");
	Version newVersion = createVersion("groupId", "artifactId", "0.1.1");
	Parameter parameterParam = new Parameter();
	parameterParam.setIgnoreMissingNewVersion("true");
	parameterParam.setIgnoreMissingOldVersion("true");
	PluginParameters pluginParameters = new PluginParameters(null, newVersion, oldVersion, parameterParam, null, Optional.of(Paths.get(System.getProperty("user.dir"), "target", "simple").toFile()), Optional.<String>absent(), true, null, null, null, null);
	ArtifactResolver artifactResolver = mock(ArtifactResolver.class);
	ArtifactResolutionResult artifactResolutionResult = mock(ArtifactResolutionResult.class);
	Set<Artifact> artifactSet = new HashSet<>();
	when(artifactResolutionResult.getArtifacts()).thenReturn(artifactSet);
	when(artifactResolver.resolve(Matchers.<ArtifactResolutionRequest>anyObject())).thenReturn(artifactResolutionResult);
	ArtifactFactory artifactFactory = mock(ArtifactFactory.class);
	when(artifactFactory.createArtifactWithClassifier(eq("groupId"), eq("artifactId"), eq("0.1.1"), anyString(), anyString())).thenReturn(mock(Artifact.class));
	MojoExecution mojoExecution = mock(MojoExecution.class);
	String executionId = "ignoreMissingVersions";
	when(mojoExecution.getExecutionId()).thenReturn(executionId);
	MavenParameters mavenParameters = new MavenParameters(new ArrayList<ArtifactRepository>(), artifactFactory, mock(ArtifactRepository.class), artifactResolver, mock(MavenProject.class), mojoExecution, "0.0.1", mock(ArtifactMetadataSource.class));
	mojo.executeWithParameters(pluginParameters, mavenParameters);
	assertThat(Files.exists(Paths.get(System.getProperty("user.dir"), "target", "simple", "japicmp", executionId + ".diff")), is(false));
	assertThat(Files.exists(Paths.get(System.getProperty("user.dir"), "target", "simple", "japicmp", executionId + ".xml")), is(false));
	assertThat(Files.exists(Paths.get(System.getProperty("user.dir"), "target", "simple", "japicmp", executionId + ".html")), is(false));
}
 
开发者ID:siom79,项目名称:japicmp,代码行数:26,代码来源:JApiCmpMojoTest.java

示例13: findArtifacts

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
/**
 * Gathers the project's artifacts and the artifacts of all its (transitive)
 * dependencies filtered by the given filter instance.
 * 
 * @param filter
 * @return
 * @throws ArtifactResolutionException
 * @throws ArtifactNotFoundException
 * @throws ProjectBuildingException
 * @throws InvalidDependencyVersionException
 */
@SuppressWarnings("unchecked")
public static Set<Artifact> findArtifacts(ArtifactFilter filter,
		ArtifactFactory factory, ArtifactResolver resolver,
		MavenProject project, Artifact artifact, ArtifactRepository local,
		List<ArtifactRepository> remoteRepos,
		ArtifactMetadataSource metadataSource)
		throws ArtifactResolutionException, ArtifactNotFoundException,
		ProjectBuildingException, InvalidDependencyVersionException {

	ArtifactResolutionResult result = resolver.resolveTransitively(
			project.getDependencyArtifacts(), artifact, local, remoteRepos,
			metadataSource, filter);

	return (Set<Artifact>) result.getArtifacts();
}
 
开发者ID:tarent,项目名称:pkg-maven-plugin,代码行数:27,代码来源:Utils.java

示例14: DefaultArtifactsResolver

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
public DefaultArtifactsResolver( ArtifactResolver theResolver, ArtifactRepository theLocal,
                                List theRemoteRepositories, boolean theStopOnFailure )
{
    this.resolver = theResolver;
    this.local = theLocal;
    this.remoteRepositories = theRemoteRepositories;
    this.stopOnFailure = theStopOnFailure;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:9,代码来源:DefaultArtifactsResolver.java

示例15: setupContainer

import org.apache.maven.artifact.resolver.ArtifactResolver; //导入依赖的package包/类
private static void setupContainer(PlexusContainer c) {
  MavenEmbedder.setImplementation(c, ArtifactFactory.class, CustomArtifactFactory.class);
  MavenEmbedder.setImplementation(c, ProjectArtifactFactory.class, CustomArtifactFactory.class);
  MavenEmbedder.setImplementation(c, ArtifactResolver.class, CustomArtifactResolver.class);
  MavenEmbedder.setImplementation(c, RepositoryMetadataManager.class, CustomRepositoryMetadataManager.class);
  MavenEmbedder.setImplementation(c, WagonManager.class, CustomWagonManager.class);
  MavenEmbedder.setImplementation(c, ModelInterpolator.class, CustomModelInterpolator.class);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:Maven2ServerEmbedderImpl.java


注:本文中的org.apache.maven.artifact.resolver.ArtifactResolver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。