本文整理匯總了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;
}
示例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;
}
示例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();
}
示例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 );
}
示例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();
}
示例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 );
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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 );
}
示例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 );
}
示例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));
}
示例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));
}