org.gradle.api.publish.maven.tasks.PublishToMavenRepository Java Examples

The following examples show how to use org.gradle.api.publish.maven.tasks.PublishToMavenRepository. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MavenPublishPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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);
            }
        });
    }
}
 
Example #2
Source File: MavenPublishPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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);
            }
        });
    }
}
 
Example #3
Source File: MavenPublishTaskModelRule.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void createPublishTasksForEachMavenRepo(TaskContainer tasks, PublishingExtension extension, MavenPublicationInternal publication, String publicationName) {
    for (MavenArtifactRepository repository : extension.getRepositories().withType(MavenArtifactRepository.class)) {
        String repositoryName = repository.getName();

        String publishTaskName = String.format("publish%sPublicationTo%sRepository", capitalize(publicationName), capitalize(repositoryName));

        PublishToMavenRepository publishTask = tasks.create(publishTaskName, PublishToMavenRepository.class);
        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));

        publishLifecycleTask.dependsOn(publishTask);
    }
}
 
Example #4
Source File: MavenPublishTaskModelRule.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void createPublishTasksForEachMavenRepo(TaskContainer tasks, PublishingExtension extension, MavenPublicationInternal publication, String publicationName) {
    for (MavenArtifactRepository repository : extension.getRepositories().withType(MavenArtifactRepository.class)) {
        String repositoryName = repository.getName();

        String publishTaskName = String.format("publish%sPublicationTo%sRepository", capitalize(publicationName), capitalize(repositoryName));

        PublishToMavenRepository publishTask = tasks.create(publishTaskName, PublishToMavenRepository.class);
        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));

        publishLifecycleTask.dependsOn(publishTask);
    }
}