Search in sources :

Example 1 with MavenPublicationInternal

use of org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal in project atlas by alibaba.

the class PublishToMavenRepositoryHook method publish.

@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);
}
Also used : InvalidUserDataException(org.gradle.api.InvalidUserDataException) MavenArtifactRepository(org.gradle.api.artifacts.repositories.MavenArtifactRepository) MavenPublicationInternal(org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal) TaskAction(org.gradle.api.tasks.TaskAction)

Example 2 with MavenPublicationInternal

use of org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal in project gradle by gradle.

the class PublishToMavenLocal method publish.

@TaskAction
public void publish() {
    final MavenPublicationInternal publication = getPublicationInternal();
    if (publication == null) {
        throw new InvalidUserDataException("The 'publication' property is required");
    }
    new PublishOperation(publication, "mavenLocal") {

        @Override
        protected void publish() throws Exception {
            MavenPublisher localPublisher = new MavenLocalPublisher(getLoggingManagerFactory(), getMavenRepositoryLocator());
            MavenPublisher staticLockingPublisher = new StaticLockingMavenPublisher(localPublisher);
            MavenPublisher validatingPublisher = new ValidatingMavenPublisher(staticLockingPublisher);
            validatingPublisher.publish(publication.asNormalisedPublication(), null);
        }
    }.run();
}
Also used : MavenLocalPublisher(org.gradle.api.publish.maven.internal.publisher.MavenLocalPublisher) InvalidUserDataException(org.gradle.api.InvalidUserDataException) MavenPublicationInternal(org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal) ValidatingMavenPublisher(org.gradle.api.publish.maven.internal.publisher.ValidatingMavenPublisher) PublishOperation(org.gradle.api.publish.internal.PublishOperation) InvalidUserDataException(org.gradle.api.InvalidUserDataException) StaticLockingMavenPublisher(org.gradle.api.publish.maven.internal.publisher.StaticLockingMavenPublisher) MavenPublisher(org.gradle.api.publish.maven.internal.publisher.MavenPublisher) StaticLockingMavenPublisher(org.gradle.api.publish.maven.internal.publisher.StaticLockingMavenPublisher) ValidatingMavenPublisher(org.gradle.api.publish.maven.internal.publisher.ValidatingMavenPublisher) TaskAction(org.gradle.api.tasks.TaskAction)

Example 3 with MavenPublicationInternal

use of org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal in project gradle by gradle.

the class PublishToMavenRepository method publish.

@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);
}
Also used : InvalidUserDataException(org.gradle.api.InvalidUserDataException) MavenArtifactRepository(org.gradle.api.artifacts.repositories.MavenArtifactRepository) MavenPublicationInternal(org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

InvalidUserDataException (org.gradle.api.InvalidUserDataException)3 MavenPublicationInternal (org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal)3 TaskAction (org.gradle.api.tasks.TaskAction)3 MavenArtifactRepository (org.gradle.api.artifacts.repositories.MavenArtifactRepository)2 PublishOperation (org.gradle.api.publish.internal.PublishOperation)1 MavenLocalPublisher (org.gradle.api.publish.maven.internal.publisher.MavenLocalPublisher)1 MavenPublisher (org.gradle.api.publish.maven.internal.publisher.MavenPublisher)1 StaticLockingMavenPublisher (org.gradle.api.publish.maven.internal.publisher.StaticLockingMavenPublisher)1 ValidatingMavenPublisher (org.gradle.api.publish.maven.internal.publisher.ValidatingMavenPublisher)1