本文整理汇总了Java中org.apache.maven.artifact.factory.ArtifactFactory类的典型用法代码示例。如果您正苦于以下问题:Java ArtifactFactory类的具体用法?Java ArtifactFactory怎么用?Java ArtifactFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ArtifactFactory类属于org.apache.maven.artifact.factory包,在下文中一共展示了ArtifactFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDependencyTree
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的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: DefaultWarPackagingContext
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的package包/类
/**
* @param webappDirectory The web application directory.
* @param webappStructure The web app structure.
* @param overlayManager The overlay manager.
* @param filterWrappers The filter wrappers
* @param nonFilteredFileExtensions The non filtered file extensions.
* @param filteringDeploymentDescriptors The filtering deployment descriptors.
* @param artifactFactory The artifact factory.
* @param resourceEncoding The resource encoding.
* @param useJvmChmod use Jvm chmod or not.
*/
public DefaultWarPackagingContext( File webappDirectory, final WebappStructure webappStructure,
final OverlayManager overlayManager,
List<FileUtils.FilterWrapper> filterWrappers,
List<String> nonFilteredFileExtensions,
boolean filteringDeploymentDescriptors, ArtifactFactory artifactFactory,
String resourceEncoding, boolean useJvmChmod )
{
this.webappDirectory = webappDirectory;
this.webappStructure = webappStructure;
this.overlayManager = overlayManager;
this.filterWrappers = filterWrappers;
this.artifactFactory = artifactFactory;
this.filteringDeploymentDescriptors = filteringDeploymentDescriptors;
this.nonFilteredFileExtensions =
nonFilteredFileExtensions == null ? Collections.<String>emptyList() : nonFilteredFileExtensions;
this.resourceEncoding = resourceEncoding;
// This is kinda stupid but if we loop over the current overlays and we request the path structure
// it will register it. This will avoid wrong warning messages in a later phase
for ( String overlayId : overlayManager.getOverlayIds() )
{
webappStructure.getStructure( overlayId );
}
this.useJvmChmod = useJvmChmod;
}
示例3: MavenEnvironment
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的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;
}
示例4: ForkedRunner
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的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();
}
示例5: customize
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的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);
}
}
示例6: DependenciesRenderer
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的package包/类
/**
*
* @param sink
* @param project
* @param mavenProjectBuilder
* @param locale
* @param listener
*/
public DependenciesRenderer( Sink sink,
MavenProject project,
MavenProjectBuilder mavenProjectBuilder,
ArtifactRepository localRepository,
ArtifactFactory factory,
I18N i18n,
Locale locale,
ReportingResolutionListener listener,
Log log )
{
super( sink );
this.project = project;
this.locale = locale;
this.listener = listener;
this.mavenProjectBuilder = mavenProjectBuilder;
this.localRepository = localRepository;
this.i18n = i18n;
this.factory = factory;
this.log = log;
}
示例7: resolve
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的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;
}
示例8: getResolvedArtifact
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的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);
}
}
示例9: getResolvedArtifactPom
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的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;
}
示例10: getProcessedP2LanucherFiles
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的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;
}
示例11: customize
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的package包/类
@Override
public void customize(@Nullable MavenWorkspaceMap workspaceMap,
boolean failOnUnresolvedDependency,
@NotNull MavenServerConsole console,
@NotNull MavenServerProgressIndicator indicator) throws RemoteException {
try {
((CustomMaven3ArtifactFactory)getComponent(ArtifactFactory.class)).customize();
((CustomMaven3ArtifactResolver)getComponent(ArtifactResolver.class)).customize(workspaceMap, failOnUnresolvedDependency);
((CustomMaven3RepositoryMetadataManager)getComponent(RepositoryMetadataManager.class)).customize(workspaceMap);
//((CustomMaven3WagonManager)getComponent(WagonManager.class)).customize(failOnUnresolvedDependency);
myWorkspaceMap = workspaceMap;
setConsoleAndIndicator(console, new MavenServerProgressIndicatorWrapper(indicator));
}
catch (Exception e) {
throw rethrowException(e);
}
}
示例12: customize
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的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);
}
}
示例13: DefaultArtifactDownloader
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的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;
}
示例14: testArtifactTouchFileName
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的package包/类
public void testArtifactTouchFileName() throws Exception
{
ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
ArtifactRepository localRepository = localRepository();
Artifact a = artifactFactory.createArtifactWithClassifier( "groupdId", "a", "0.0.1-SNAPSHOT", "jar", null );
File file = new File( localRepository.getBasedir(),
localRepository.pathOf( a ) );
a.setFile( file );
assertEquals( "a-0.0.1-SNAPSHOT.jar.lastUpdated", updateCheckManager.getTouchfile( a ).getName() );
a = artifactFactory.createArtifactWithClassifier( "groupdId", "a", "0.0.1-SNAPSHOT", "jar", "classifier" );
file = new File( localRepository.getBasedir(),
localRepository.pathOf( a ) );
a.setFile( file );
assertEquals( "a-0.0.1-SNAPSHOT-classifier.jar.lastUpdated", updateCheckManager.getTouchfile( a ).getName() );
}
示例15: setUp
import org.apache.maven.artifact.factory.ArtifactFactory; //导入依赖的package包/类
@Override
protected void setUp()
throws Exception
{
super.setUp();
artifactFactory = lookup( ArtifactFactory.class);
artifactRepositoryFactory = lookup( ArtifactRepositoryFactory.class );
RepositorySystemSession repoSession = initRepoSession();
MavenSession session =
new MavenSession( getContainer(), repoSession, new DefaultMavenExecutionRequest(),
new DefaultMavenExecutionResult() );
LegacySupport legacySupport = lookup(LegacySupport.class);
legacySupport.setSession( session );
}