use of org.gradle.api.artifacts.repositories.MavenArtifactRepository in project gradle by gradle.
the class MavenPublishPlugin method realizePublishingTasksLater.
private void realizePublishingTasksLater(final Project project, final PublishingExtension extension) {
final NamedDomainObjectSet<MavenPublicationInternal> mavenPublications = extension.getPublications().withType(MavenPublicationInternal.class);
final TaskContainer tasks = project.getTasks();
final DirectoryProperty buildDirectory = project.getLayout().getBuildDirectory();
final TaskProvider<Task> publishLifecycleTask = tasks.named(PublishingPlugin.PUBLISH_LIFECYCLE_TASK_NAME);
final TaskProvider<Task> publishLocalLifecycleTask = tasks.named(PUBLISH_LOCAL_LIFECYCLE_TASK_NAME);
final NamedDomainObjectList<MavenArtifactRepository> repositories = extension.getRepositories().withType(MavenArtifactRepository.class);
repositories.all(repository -> tasks.register(publishAllToSingleRepoTaskName(repository), publish -> {
publish.setDescription("Publishes all Maven publications produced by this project to the " + repository.getName() + " repository.");
publish.setGroup(PublishingPlugin.PUBLISH_TASK_GROUP);
}));
mavenPublications.all(publication -> {
createGenerateMetadataTask(tasks, publication, mavenPublications, buildDirectory);
createGeneratePomTask(tasks, publication, buildDirectory, project);
createLocalInstallTask(tasks, publishLocalLifecycleTask, publication);
createPublishTasksForEachMavenRepo(tasks, publishLifecycleTask, publication, repositories);
});
}
use of org.gradle.api.artifacts.repositories.MavenArtifactRepository in project gradle by gradle.
the class PublishToMavenRepository method computeSpec.
private PublishSpec computeSpec() {
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");
}
getDuplicatePublicationTracker().checkCanPublish(publicationInternal, repository.getUrl(), repository.getName());
MavenNormalizedPublication normalizedPublication = publicationInternal.asNormalisedPublication();
return new PublishSpec(RepositorySpec.of(repository), normalizedPublication);
}
use of org.gradle.api.artifacts.repositories.MavenArtifactRepository in project gradle by gradle.
the class DefaultBaseRepositoryFactory method createMavenLocalRepository.
@Override
public MavenArtifactRepository createMavenLocalRepository() {
MavenArtifactRepository mavenRepository = instantiator.newInstance(DefaultMavenLocalArtifactRepository.class, fileResolver, transportFactory, locallyAvailableResourceFinder, instantiatorFactory, artifactFileStore, pomParser, metadataParser, createAuthenticationContainer(), fileResourceRepository, mavenMetadataFactory, isolatableFactory, objectFactory, urlArtifactRepositoryFactory, checksumService);
File localMavenRepository = localMavenRepositoryLocator.getLocalMavenRepository();
mavenRepository.setUrl(localMavenRepository);
return mavenRepository;
}
use of org.gradle.api.artifacts.repositories.MavenArtifactRepository in project gradle by gradle.
the class DefaultBaseRepositoryFactory method createGradlePluginPortal.
@Override
public ArtifactRepository createGradlePluginPortal() {
MavenArtifactRepository mavenRepository = createMavenRepository(new NamedMavenRepositoryDescriber(PLUGIN_PORTAL_DEFAULT_URL));
mavenRepository.setUrl(System.getProperty(PLUGIN_PORTAL_OVERRIDE_URL_PROPERTY, PLUGIN_PORTAL_DEFAULT_URL));
mavenRepository.metadataSources(MavenArtifactRepository.MetadataSources::mavenPom);
return mavenRepository;
}
use of org.gradle.api.artifacts.repositories.MavenArtifactRepository in project gradle by gradle.
the class DefaultBaseRepositoryFactory method createMavenCentralRepository.
@Override
public MavenArtifactRepository createMavenCentralRepository() {
MavenArtifactRepository mavenRepository = createMavenRepository(new NamedMavenRepositoryDescriber(RepositoryHandler.MAVEN_CENTRAL_URL));
mavenRepository.setUrl(RepositoryHandler.MAVEN_CENTRAL_URL);
return mavenRepository;
}
Aggregations