本文整理汇总了Java中org.gradle.api.artifacts.repositories.MavenArtifactRepository类的典型用法代码示例。如果您正苦于以下问题:Java MavenArtifactRepository类的具体用法?Java MavenArtifactRepository怎么用?Java MavenArtifactRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MavenArtifactRepository类属于org.gradle.api.artifacts.repositories包,在下文中一共展示了MavenArtifactRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPublishTasksForEachMavenRepo
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的package包/类
private void createPublishTasksForEachMavenRepo(ModelMap<Task> tasks, PublishingExtension extension, final Task publishLifecycleTask, final MavenPublicationInternal publication,
final String publicationName) {
for (final MavenArtifactRepository repository : extension.getRepositories().withType(MavenArtifactRepository.class)) {
final String repositoryName = repository.getName();
String publishTaskName = "publish" + capitalize(publicationName) + "PublicationTo" + capitalize(repositoryName) + "Repository";
tasks.create(publishTaskName, PublishToMavenRepository.class, new Action<PublishToMavenRepository>() {
public void execute(PublishToMavenRepository publishTask) {
publishTask.setPublication(publication);
publishTask.setRepository(repository);
publishTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
publishTask.setDescription("Publishes Maven publication '" + publicationName + "' to Maven repository '" + repositoryName + "'.");
}
});
publishLifecycleTask.dependsOn(publishTaskName);
}
}
示例2: resolvePluginDependencies
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的package包/类
private ClassPath resolvePluginDependencies(final PluginUseMetaData metadata) {
DependencyResolutionServices resolution = dependencyResolutionServicesFactory.create();
RepositoryHandler repositories = resolution.getResolveRepositoryHandler();
final String repoUrl = metadata.implementation.get("repo");
repositories.maven(new Action<MavenArtifactRepository>() {
public void execute(MavenArtifactRepository mavenArtifactRepository) {
mavenArtifactRepository.setUrl(repoUrl);
}
});
Dependency dependency = resolution.getDependencyHandler().create(metadata.implementation.get("gav"));
ConfigurationContainerInternal configurations = (ConfigurationContainerInternal) resolution.getConfigurationContainer();
ConfigurationInternal configuration = configurations.detachedConfiguration(dependency);
try {
Set<File> files = configuration.getResolvedConfiguration().getFiles(Specs.satisfyAll());
return new DefaultClassPath(files);
} catch (ResolveException e) {
throw new DependencyResolutionException("Failed to resolve all plugin dependencies from " + repoUrl, e.getCause());
}
}
示例3: internalCreateArtifactRepository
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的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());
}
});
}
}
});
}
示例4: createAndroidTasks
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的package包/类
@Mutate
public void createAndroidTasks(
ModelMap<Task> tasks,
ModelMap<AndroidComponentSpec> androidSpecs,
TaskManager taskManager,
SdkHandler sdkHandler,
Project project, AndroidComponentModelSourceSet androidSources) {
// setup SDK repositories.
for (final File file : sdkHandler.getSdkLoader().getRepositories()) {
project.getRepositories().maven(new Action<MavenArtifactRepository>() {
@Override
public void execute(MavenArtifactRepository repo) {
repo.setUrl(file.toURI());
}
});
}
// TODO: determine how to provide functionalities of variant API objects.
}
示例5: createPublishTasksForEachMavenRepo
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的package包/类
private void createPublishTasksForEachMavenRepo(CollectionBuilder<Task> tasks, PublishingExtension extension, final Task publishLifecycleTask, final MavenPublicationInternal publication,
final String publicationName) {
for (final MavenArtifactRepository repository : extension.getRepositories().withType(MavenArtifactRepository.class)) {
final String repositoryName = repository.getName();
String publishTaskName = String.format("publish%sPublicationTo%sRepository", capitalize(publicationName), capitalize(repositoryName));
tasks.create(publishTaskName, PublishToMavenRepository.class, new Action<PublishToMavenRepository>() {
public void execute(PublishToMavenRepository publishTask) {
publishTask.setPublication(publication);
publishTask.setRepository(repository);
publishTask.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
publishTask.setDescription(String.format("Publishes Maven publication '%s' to Maven repository '%s'.", publicationName, repositoryName));
//Because dynamic rules are not yet implemented we have to violate input immutability here as an interim step
publishLifecycleTask.dependsOn(publishTask);
}
});
}
}
示例6: mavenRepo
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的package包/类
public DependencyResolver mavenRepo(Map<String, ?> args, Closure configClosure) {
DeprecationLogger.nagUserOfReplacedMethod("RepositoryHandler.mavenRepo()", "maven()");
Map<String, Object> modifiedArgs = new HashMap<String, Object>(args);
if (modifiedArgs.containsKey("urls")) {
List<?> urls = flattenCollections(modifiedArgs.remove("urls"));
if (!urls.isEmpty()) {
modifiedArgs.put("url", urls.get(0));
List<?> extraUrls = urls.subList(1, urls.size());
modifiedArgs.put("artifactUrls", extraUrls);
}
}
MavenArtifactRepository repository = repositoryFactory.createMavenRepository();
ConfigureUtil.configureByMap(modifiedArgs, repository);
DependencyResolver resolver = repositoryFactory.toResolver(repository);
ConfigureUtil.configure(configClosure, resolver);
addRepository(repositoryFactory.createResolverBackedRepository(resolver), "mavenRepo");
return resolver;
}
示例7: publish
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的package包/类
@TaskAction
public void publish() {
MavenPublicationInternal publicationInternal = getPublicationInternal();
if (publicationInternal == null) {
throw new InvalidUserDataException("The 'publication' property is required");
}
MavenArtifactRepository repository = getRepository();
if (repository == null) {
throw new InvalidUserDataException("The 'repository' property is required");
}
doPublish(publicationInternal, repository);
}
示例8: doPublish
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的package包/类
private void doPublish(final MavenPublicationInternal publication, final MavenArtifactRepository repository) {
new PublishOperation(publication, repository.getName()) {
@Override
protected void publish() throws Exception {
MavenPublisher remotePublisher = new MavenRemotePublisher(getLoggingManagerFactory(), getMavenRepositoryLocator(), getTemporaryDirFactory(), getRepositoryTransportFactory());
MavenPublisher staticLockingPublisher = new StaticLockingMavenPublisher(remotePublisher);
MavenPublisher validatingPublisher = new ValidatingMavenPublisher(staticLockingPublisher);
validatingPublisher.publish(publication.asNormalisedPublication(), repository);
}
}.run();
}
示例9: GradleWagonMavenDeployAction
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的package包/类
public GradleWagonMavenDeployAction(File pomFile, MavenArtifactRepository artifactRepository, RepositoryTransportFactory repositoryTransportFactory) {
super(pomFile, null);
this.artifactRepository = artifactRepository;
this.repositoryTransportFactory = repositoryTransportFactory;
registerWagonProtocols();
}
示例10: publish
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的package包/类
public void publish(MavenNormalizedPublication publication, MavenArtifactRepository artifactRepository) {
validateIdentity(publication);
validateArtifacts(publication);
checkNoDuplicateArtifacts(publication);
delegate.publish(publication, artifactRepository);
}
示例11: publish
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的package包/类
public void publish(MavenNormalizedPublication publication, MavenArtifactRepository artifactRepository) {
STATIC_LOCK.lock();
try {
delegate.publish(publication, artifactRepository);
} finally {
STATIC_LOCK.unlock();
}
}
示例12: gradle
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的package包/类
public MavenArtifactRepository gradle(final Action<? super MavenArtifactRepository> action) {
return repositories.maven(new Action<MavenArtifactRepository>() {
public void execute(MavenArtifactRepository repository) {
repository.setName("gradleJs");
repository.setUrl(GRADLE_PUBLIC_JAVASCRIPT_REPO_URL);
action.execute(repository);
}
});
}
示例13: createArtifactRepository
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的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");
}
});
}
示例14: createMavenLocalRepository
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的package包/类
public MavenArtifactRepository createMavenLocalRepository() {
MavenArtifactRepository mavenRepository = instantiator.newInstance(DefaultMavenLocalArtifactRepository.class, fileResolver, transportFactory,
locallyAvailableResourceFinder, instantiator, artifactFileStore, pomParser, createAuthenticationContainer());
final File localMavenRepository = localMavenRepositoryLocator.getLocalMavenRepository();
mavenRepository.setUrl(localMavenRepository);
return mavenRepository;
}
示例15: publish
import org.gradle.api.artifacts.repositories.MavenArtifactRepository; //导入依赖的package包/类
@TaskAction
public void publish() {
MavenPublicationInternal publicationInternal = getPublicationInternal();
if (publicationInternal == null) {
throw new InvalidUserDataException("The 'publication' property is required");
}
MavenArtifactRepository repository = getRepository();
if (repository == null) {
throw new InvalidUserDataException("The 'repository' property is required");
}
doPublish(publicationInternal, repository);
}