/* * Enables maven publish handling on build process * * Project: gradle * Author: Marc Böhm * License: MIT License (see LICENSE.md) * * Copyright (c) captica GmbH est. 2021 */ // Load external plugins buildscript { repositories { gradlePluginPortal() mavenCentral() } } project.ext { mavenAccessToken = ( project.hasProperty('MAVEN_PUBLISH_ACCESS_TOKEN') ? MAVEN_PUBLISH_ACCESS_TOKEN : null ) mavenRepositoryUrl = ( project.hasProperty('MAVEN_PUBLISH_REPOSITORY_URL') ? MAVEN_PUBLISH_REPOSITORY_URL : null ) } // Apply plugins apply plugin: 'maven-publish' if ( ext.mavenAccessToken == null || ext.mavenRepositoryUrl == null ) { logger.error("ERROR: Maven publish not possible! Missing required properties: MAVEN_PUBLISH_ACCESS_TOKEN and MAVEN_PUBLISH_REPOSITORY_URL") } else { // Configure maven publish publishing { publications { bootJava(MavenPublication) { artifact tasks.named("bootJar") } } repositories { maven { name = "git.captica.de" url uri(mavenRepositoryUrl) credentials(HttpHeaderCredentials) { name = "Authorization" value = "token ${mavenAccessToken}" } authentication { header(HttpHeaderAuthentication) } } } } }