本文整理汇总了Java中org.gradle.api.artifacts.repositories.ArtifactRepository类的典型用法代码示例。如果您正苦于以下问题:Java ArtifactRepository类的具体用法?Java ArtifactRepository怎么用?Java ArtifactRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArtifactRepository类属于org.gradle.api.artifacts.repositories包,在下文中一共展示了ArtifactRepository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: extract
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
public String extract() {
Collection<Upload> tasks = project.getTasks().withType(Upload.class);
Collection<ArtifactRepository> repositories = getRepositories(tasks);
if (!onlyContainsMavenResolvers(repositories)) {
return project.getName();
}
Collection<MavenDeployer> deployers = getMavenDeployers(repositories);
Set<String> artifactIds = getArtifactIds(deployers);
if (artifactIds.size() == 1) {
String artifactId = artifactIds.iterator().next();
if (artifactId != null && !artifactId.equals(MavenProject.EMPTY_PROJECT_ARTIFACT_ID)) {
return artifactId;
}
}
String baseName = getArchivesBaseName();
return baseName != null ? baseName : project.getName();
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:ProjectDependencyArtifactIdExtractorHack.java
示例2: internalCreateArtifactRepository
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
@Override
protected ArtifactRepository internalCreateArtifactRepository(RepositoryHandler repositoryHandler) {
return repositoryHandler.maven(new Action<MavenArtifactRepository>() {
@Override
public void execute(MavenArtifactRepository mavenArtifactRepository) {
mavenArtifactRepository.setName(getArtifactRepositoryName());
mavenArtifactRepository.setUrl(getUrl());
Credentials credentials = authenticationSupport().getConfiguredCredentials();
if (credentials != null) {
((AuthenticationSupportedInternal)mavenArtifactRepository).setConfiguredCredentials(credentials);
mavenArtifactRepository.authentication(new Action<AuthenticationContainer>() {
@Override
public void execute(AuthenticationContainer authenticationContainer) {
authenticationContainer.addAll(authenticationSupport().getConfiguredAuthentication());
}
});
}
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:DefaultMavenPluginRepository.java
示例3: internalCreateArtifactRepository
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
@Override
protected ArtifactRepository internalCreateArtifactRepository(RepositoryHandler repositoryHandler) {
return repositoryHandler.ivy(new Action<IvyArtifactRepository>() {
@Override
public void execute(IvyArtifactRepository ivyArtifactRepository) {
ivyArtifactRepository.setName(getArtifactRepositoryName());
ivyArtifactRepository.setUrl(getUrl());
Credentials credentials = authenticationSupport().getConfiguredCredentials();
if (credentials != null) {
((AuthenticationSupportedInternal)ivyArtifactRepository).setConfiguredCredentials(credentials);
ivyArtifactRepository.authentication(new Action<AuthenticationContainer>() {
@Override
public void execute(AuthenticationContainer authenticationContainer) {
authenticationContainer.addAll(authenticationSupport().getConfiguredAuthentication());
}
});
}
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:DefaultIvyPluginRepository.java
示例4: extract
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
public String extract() {
Collection<Upload> tasks = project.getTasks().withType(Upload.class);
Collection<ArtifactRepository> repositories = getRepositories(tasks);
if (!onlyContainsMavenResolvers(repositories)) { return project.getName(); }
Collection<MavenDeployer> deployers = getMavenDeployers(repositories);
Set<String> artifactIds = getArtifactIds(deployers);
if (artifactIds.size() == 1) {
String artifactId = artifactIds.iterator().next();
if (artifactId != null && !artifactId.equals(MavenProject.EMPTY_PROJECT_ARTIFACT_ID)) {
return artifactId;
}
}
String baseName = getArchivesBaseName();
return baseName != null ? baseName : project.getName();
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:17,代码来源:ProjectDependencyArtifactIdExtractorHack.java
示例5: addAfter
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
public DependencyResolver addAfter(Object userDescription, final String beforeResolverName, Closure configureClosure) {
if (!GUtil.isTrue(beforeResolverName)) {
throw new InvalidUserDataException("You must specify beforeResolverName");
}
DeprecationLogger.nagUserOfDiscontinuedMethod("ArtifactRepositoryContainer.addAfter()");
final ArtifactRepository before = getByName(beforeResolverName);
return addCustomDependencyResolver(userDescription, configureClosure, new Action<ArtifactRepository>() {
public void execute(ArtifactRepository repository) {
int insertPos = indexOf(before) + 1;
if (insertPos == size()) {
DefaultArtifactRepositoryContainer.super.add(repository);
} else {
DefaultArtifactRepositoryContainer.this.add(insertPos, repository);
}
}
});
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:19,代码来源:DefaultArtifactRepositoryContainer.java
示例6: getRepositories
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
private Collection<ArtifactRepository> getRepositories(Collection<Upload> tasks) {
Collection<ArtifactRepository> result = Lists.newArrayList();
for (Upload task : tasks) {
result.addAll(task.getRepositories());
}
return result;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:ProjectDependencyArtifactIdExtractorHack.java
示例7: onlyContainsMavenResolvers
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
private boolean onlyContainsMavenResolvers(Collection<ArtifactRepository> repositories) {
for (ArtifactRepository repository : repositories) {
if (!(repository instanceof MavenResolver)) {
return false;
}
}
return true;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:ProjectDependencyArtifactIdExtractorHack.java
示例8: getMavenDeployers
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
private Collection<MavenDeployer> getMavenDeployers(Collection<ArtifactRepository> repositories) {
Collection<MavenDeployer> result = Lists.newArrayList();
for (ArtifactRepository repository : repositories) {
if (repository instanceof MavenDeployer) {
result.add((MavenDeployer) repository);
}
}
return result;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:ProjectDependencyArtifactIdExtractorHack.java
示例9: createArtifactRepository
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
@Override
public ArtifactRepository createArtifactRepository(RepositoryHandler repositoryHandler) {
return repositoryHandler.maven(new Action<MavenArtifactRepository>() {
@Override
public void execute(MavenArtifactRepository mavenArtifactRepository) {
mavenArtifactRepository.setUrl("https://plugins.gradle.org/m2");
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:DefaultGradlePluginPortal.java
示例10: DefaultRepositories
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
private DefaultRepositories(final Instantiator instantiator, final SourceDirectorySetFactory sourceDirectorySetFactory, final Action<PrebuiltLibrary> binaryFactory) {
super(ArtifactRepository.class, instantiator, new ArtifactRepositoryNamer());
registerFactory(PrebuiltLibraries.class, new NamedDomainObjectFactory<PrebuiltLibraries>() {
public PrebuiltLibraries create(String name) {
return instantiator.newInstance(DefaultPrebuiltLibraries.class, name, instantiator, sourceDirectorySetFactory, binaryFactory);
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:NativeComponentModelPlugin.java
示例11: DefaultArtifactRepositoryContainer
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
public DefaultArtifactRepositoryContainer(Instantiator instantiator) {
super(ArtifactRepository.class, instantiator, new RepositoryNamer());
whenObjectAdded(new Action<ArtifactRepository>() {
public void execute(ArtifactRepository artifactRepository) {
if (artifactRepository instanceof ArtifactRepositoryInternal) {
ArtifactRepositoryInternal repository = (ArtifactRepositoryInternal) artifactRepository;
repository.onAddToContainer(DefaultArtifactRepositoryContainer.this);
}
}
});
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:DefaultArtifactRepositoryContainer.java
示例12: addWithUniqueName
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
private <T extends ArtifactRepository> T addWithUniqueName(T repository, String defaultName, Action<? super T> insertion) {
String repositoryName = repository.getName();
if (!GUtil.isTrue(repositoryName)) {
repository.setName(uniquifyName(defaultName));
} else {
repository.setName(uniquifyName(repositoryName));
}
assertCanAdd(repository.getName());
insertion.execute(repository);
return repository;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:13,代码来源:DefaultArtifactRepositoryContainer.java
示例13: getMavenRepositories
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
public static List<DefaultMavenArtifactRepository> getMavenRepositories(Project project) {
List<DefaultMavenArtifactRepository> repos = new ArrayList<>();
PublishingExtension publishingExtension = getPublishingExtension(project);
if (publishingExtension != null) {
RepositoryHandler repositoryHandler = publishingExtension.getRepositories();
for (ArtifactRepository repo : repositoryHandler) {
repos.add((DefaultMavenArtifactRepository)repo);
}
}
return repos;
}
开发者ID:ctco,项目名称:gradle-mobile-plugin,代码行数:12,代码来源:XdepsUtil.java
示例14: DefaultRepositories
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
private DefaultRepositories(final Instantiator instantiator, final FileResolver fileResolver, final Action<PrebuiltLibrary> binaryFactory) {
super(ArtifactRepository.class, instantiator, new ArtifactRepositoryNamer());
registerFactory(PrebuiltLibraries.class, new NamedDomainObjectFactory<PrebuiltLibraries>() {
public PrebuiltLibraries create(String name) {
return instantiator.newInstance(DefaultPrebuiltLibraries.class, name, instantiator, fileResolver, binaryFactory);
}
});
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:9,代码来源:NativeComponentModelPlugin.java
示例15: addBefore
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
public DependencyResolver addBefore(Object userDescription, final String afterResolverName, Closure configureClosure) {
if (!GUtil.isTrue(afterResolverName)) {
throw new InvalidUserDataException("You must specify afterResolverName");
}
DeprecationLogger.nagUserOfDiscontinuedMethod("ArtifactRepositoryContainer.addBefore()");
final ArtifactRepository after = getByName(afterResolverName);
return addCustomDependencyResolver(userDescription, configureClosure, new Action<ArtifactRepository>() {
public void execute(ArtifactRepository repository) {
DefaultArtifactRepositoryContainer.super.add(indexOf(after), repository);
}
});
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:13,代码来源:DefaultArtifactRepositoryContainer.java
示例16: addCustomDependencyResolver
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
private DependencyResolver addCustomDependencyResolver(Object userDescription, Closure configureClosure, Action<ArtifactRepository> orderAction) {
ArtifactRepository repository = baseRepositoryFactory.createRepository(userDescription);
DependencyResolver resolver = baseRepositoryFactory.toResolver(repository);
ConfigureUtil.configure(configureClosure, resolver);
ArtifactRepository resolverRepository = baseRepositoryFactory.createResolverBackedRepository(resolver);
addWithUniqueName(resolverRepository, "repository", orderAction);
return resolver;
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:9,代码来源:DefaultArtifactRepositoryContainer.java
示例17: getResolvers
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
public List<DependencyResolver> getResolvers() {
DeprecationLogger.nagUserOfDiscontinuedMethod("ArtifactRepositoryContainer.getResolvers()");
List<DependencyResolver> returnedResolvers = new ArrayList<DependencyResolver>();
for (ArtifactRepository repository : this) {
returnedResolvers.add(baseRepositoryFactory.toResolver(repository));
}
return returnedResolvers;
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:9,代码来源:DefaultArtifactRepositoryContainer.java
示例18: addWithUniqueName
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
private <T extends ArtifactRepository> T addWithUniqueName(T repository, String defaultName, Action<? super T> insertion) {
String repositoryName = repository.getName();
if (!GUtil.isTrue(repositoryName)) {
repository.setName(uniquifyName(defaultName));
} else {
repository.setName(uniquifyName(repositoryName));
}
assertCanAdd(repository.getName());
insertion.execute(repository);
cast(ArtifactRepositoryInternal.class, repository).onAddToContainer(this);
return repository;
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:14,代码来源:DefaultArtifactRepositoryContainer.java
示例19: execute
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
@Override
public void execute(DependencyResolveDetails dependencyResolveDetails) {
String group = dependencyResolveDetails.getTarget().getGroup();
String name = dependencyResolveDetails.getTarget().getName();
if (aetherPlugin.getVersionMap().containsKey(group) && aetherPlugin.getVersionMap().get(group).containsKey(name)) {
if (dependencyResolveDetails.getRequested().getVersion().equals(dependencyResolveDetails.getTarget().getVersion())) {
dependencyResolveDetails.useVersion(aetherPlugin.getVersionMap().get(group).get(name));
}
} else {
RepositorySystem system = setupRepositorySystem();
RepositorySystemSession session = setupSession(project, system);
List<RemoteRepository> remoteRepositories = new ArrayList<>();
for (ArtifactRepository artifactRepository : project.getRepositories()) {
if (artifactRepository instanceof MavenArtifactRepository) {
MavenArtifactRepository mavenArtifactRepository = (MavenArtifactRepository) artifactRepository;
remoteRepositories.add(new RemoteRepository.Builder(mavenArtifactRepository.getName(), "default", mavenArtifactRepository.getUrl().toString()).build());
}
}
Artifact artifact = new DefaultArtifact(dependencyResolveDetails.getTarget().getGroup()
+ ":" + dependencyResolveDetails.getTarget().getName()
+ ":" + dependencyResolveDetails.getTarget().getVersion());
CollectRequest collectRequest = new CollectRequest();
String scope;
if (configuration.getName().contains("test")) {
scope = JavaScopes.TEST;
} else if (configuration.getName().contains("runtime")) {
scope = JavaScopes.RUNTIME;
} else if (configuration.getName().equals("providedCompile")
|| configuration.getName().equals("compileOnly")) {
scope = JavaScopes.PROVIDED;
} else
scope = JavaScopes.COMPILE;
collectRequest.setRoot(new Dependency(artifact, scope));
collectRequest.setRepositories(remoteRepositories);
try {
CollectResult collectResult = system.collectDependencies(session, collectRequest);
processDependencyNode(collectResult.getRoot());
} catch (DependencyCollectionException e) {
e.printStackTrace();
}
}
}
开发者ID:SetoKaiba,项目名称:aether-gradle-plugin,代码行数:45,代码来源:VersionResolverDependencyResolveDetails.java
示例20: gradle
import org.gradle.api.artifacts.repositories.ArtifactRepository; //导入依赖的package包/类
public ArtifactRepository gradle() {
return gradle(Actions.doNothing());
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:JavaScriptRepositoriesExtension.java
注:本文中的org.gradle.api.artifacts.repositories.ArtifactRepository类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论