當前位置: 首頁>>代碼示例>>Java>>正文


Java ArtifactMetadataSource類代碼示例

本文整理匯總了Java中org.apache.maven.artifact.metadata.ArtifactMetadataSource的典型用法代碼示例。如果您正苦於以下問題:Java ArtifactMetadataSource類的具體用法?Java ArtifactMetadataSource怎麽用?Java ArtifactMetadataSource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ArtifactMetadataSource類屬於org.apache.maven.artifact.metadata包,在下文中一共展示了ArtifactMetadataSource類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDependencyTree

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:DependencyTreeFactory.java

示例2: MavenEnvironment

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的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;
}
 
開發者ID:mirkosertic,項目名稱:mavensonarsputnik,代碼行數:21,代碼來源:MavenEnvironment.java

示例3: ForkedRunner

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的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

示例4: resolveTransitively

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的package包/類
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
                                                     List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener> listeners,
                                                     List<ConflictResolver> conflictResolvers )
  throws ArtifactResolutionException, ArtifactNotFoundException
{
  ArtifactResolutionRequest request = new ArtifactResolutionRequest()
    .setArtifact( originatingArtifact )
    .setResolveRoot( false )
      // This is required by the surefire plugin
    .setArtifactDependencies( artifacts )
    .setManagedVersionMap( managedVersions )
    .setLocalRepository( localRepository )
    .setRemoteRepositories( remoteRepositories )
    .setCollectionFilter( filter )
    .setListeners( listeners );

  injectSession2( request, legacySupport.getSession() );

  return resolveWithExceptions( request );
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:CustomMaven3ArtifactResolver.java

示例5: retrieveAvailableVersions

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的package包/類
@NotNull
@Override
public List<String> retrieveAvailableVersions(@NotNull String groupId,
                                              @NotNull String artifactId,
                                              @NotNull List<MavenRemoteRepository> remoteRepositories)
  throws RemoteException {
  try {
    Artifact artifact =
      new DefaultArtifact(groupId, artifactId, "", Artifact.SCOPE_COMPILE, "pom", null, new DefaultArtifactHandler("pom"));
    List<ArtifactVersion> versions = getComponent(ArtifactMetadataSource.class)
      .retrieveAvailableVersions(
        artifact,
        getLocalRepository(),
        convertRepositories(remoteRepositories));
    return ContainerUtil.map(versions, new Function<ArtifactVersion, String>() {
      @Override
      public String fun(ArtifactVersion version) {
        return version.toString();
      }
    });
  }
  catch (Exception e) {
    Maven3ServerGlobals.getLogger().info(e);
  }
  return Collections.emptyList();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:Maven3ServerEmbedder.java

示例6: resolveTransitively

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的package包/類
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
                                                     Map managedVersions, ArtifactRepository localRepository,
                                                     List<ArtifactRepository> remoteRepositories,
                                                     ArtifactMetadataSource source, ArtifactFilter filter,
                                                     List<ResolutionListener> listeners,
                                                     List<ConflictResolver> conflictResolvers )
  throws ArtifactResolutionException, ArtifactNotFoundException
{
  ArtifactResolutionRequest request = new ArtifactResolutionRequest()
    .setArtifact( originatingArtifact )
    .setResolveRoot( false )
      // This is required by the surefire plugin
    .setArtifactDependencies( artifacts )
    .setManagedVersionMap( managedVersions )
    .setLocalRepository( localRepository )
    .setRemoteRepositories( remoteRepositories )
    .setCollectionFilter( filter )
    .setListeners( listeners );

  injectSession2( request, legacySupport.getSession() );

  return resolveWithExceptions( request );
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:CustomMaven32ArtifactResolver.java

示例7: resolveTransitively

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的package包/類
public ArtifactResolutionResult resolveTransitively(
    Set<Artifact> artifacts,
    Artifact originatingArtifact,
    ArtifactRepository localRepository,
    List<ArtifactRepository> remoteRepositories,
    ArtifactMetadataSource source,
    ArtifactFilter filter)
    throws ArtifactResolutionException, ArtifactNotFoundException {
  return resolveTransitively(
      artifacts,
      originatingArtifact,
      Collections.EMPTY_MAP,
      localRepository,
      remoteRepositories,
      source,
      filter);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:18,代碼來源:CheArtifactResolver.java

示例8: createHelper

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的package包/類
private DefaultVersionsHelper createHelper( String rulesUri, ArtifactMetadataSource metadataSource )
    throws MojoExecutionException
{
    final DefaultWagonManager wagonManager = new DefaultWagonManager()
    {
        public Wagon getWagon( Repository repository )
            throws UnsupportedProtocolException, WagonConfigurationException
        {
            return new FileWagon();
        }
    };

    DefaultVersionsHelper helper =
        new DefaultVersionsHelper( new DefaultArtifactFactory(), new DefaultArtifactResolver(), metadataSource, new ArrayList(),
                                   new ArrayList(),
                                   new DefaultArtifactRepository( "", "", new DefaultRepositoryLayout() ),
                                   wagonManager, new Settings(), "", rulesUri, mock( Log.class ), mock( MavenSession.class ),
                                   new DefaultPathTranslator());
    return helper;
}
 
開發者ID:mojohaus,項目名稱:versions-maven-plugin,代碼行數:21,代碼來源:DefaultVersionsHelperTest.java

示例9: createHelper

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的package包/類
private VersionsHelper createHelper( String rulesUri, ArtifactMetadataSource metadataSource )
    throws MojoExecutionException
{
    final DefaultWagonManager wagonManager = new DefaultWagonManager()
    {
        public Wagon getWagon( Repository repository )
            throws UnsupportedProtocolException, WagonConfigurationException
        {
            return new FileWagon();
        }
    };

    VersionsHelper helper =
        new DefaultVersionsHelper( new DefaultArtifactFactory(), new DefaultArtifactResolver(), metadataSource, new ArrayList(),
                                   new ArrayList(),
                                   new DefaultArtifactRepository( "", "", new DefaultRepositoryLayout() ),
                                   wagonManager, new Settings(), "", rulesUri, mock( Log.class ), mock( MavenSession.class ),
                                   new DefaultPathTranslator());
    return helper;
}
 
開發者ID:petr-ujezdsky,項目名稱:versions-maven-plugin-svn-clone,代碼行數:21,代碼來源:DefaultVersionsHelperTest.java

示例10: resolve

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的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

示例11: DefaultArtifactDownloader

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的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

示例12: collect

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的package包/類
public ArtifactResolutionResult collect( Set<Artifact> artifacts, Artifact originatingArtifact,
                                         Map managedVersions, ArtifactRepository localRepository,
                                         List<ArtifactRepository> remoteRepositories,
                                         ArtifactMetadataSource source, ArtifactFilter filter,
                                         List<ResolutionListener> listeners,
                                         List<ConflictResolver> conflictResolvers )
{
    ArtifactResolutionRequest request = new ArtifactResolutionRequest();
    request.setLocalRepository( localRepository );
    request.setRemoteRepositories( remoteRepositories );
    injectSession( request );
    return collect( artifacts, originatingArtifact, managedVersions, request, source, filter, listeners,
                    conflictResolvers );
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:15,代碼來源:DefaultLegacyArtifactCollector.java

示例13: resolveTransitively

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的package包/類
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
                                                     List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener> listeners,
                                                     List<ConflictResolver> conflictResolvers )
    throws ArtifactResolutionException, ArtifactNotFoundException
{
    ArtifactResolutionRequest request = new ArtifactResolutionRequest()
        .setArtifact( originatingArtifact )
        .setResolveRoot( false )
        // This is required by the surefire plugin
        .setArtifactDependencies( artifacts )            
        .setManagedVersionMap( managedVersions )
        .setLocalRepository( localRepository )
        .setRemoteRepositories( remoteRepositories )
        .setCollectionFilter( filter )
        .setListeners( listeners );

    injectSession2( request, legacySupport.getSession() );

    return resolveWithExceptions( request );
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:21,代碼來源:DefaultArtifactResolver.java

示例14: testSimple

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的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

示例15: testIgnoreMissingVersions

import org.apache.maven.artifact.metadata.ArtifactMetadataSource; //導入依賴的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


注:本文中的org.apache.maven.artifact.metadata.ArtifactMetadataSource類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。