CAPAUT-471 Refactor error handling to avoid broken builds
This commit is contained in:
@@ -21,34 +21,34 @@ project.ext {
|
|||||||
mavenRepositoryUrl = ( project.hasProperty('MAVEN_PUBLISH_REPOSITORY_URL') ? MAVEN_PUBLISH_REPOSITORY_URL : null )
|
mavenRepositoryUrl = ( project.hasProperty('MAVEN_PUBLISH_REPOSITORY_URL') ? MAVEN_PUBLISH_REPOSITORY_URL : null )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fail fast
|
|
||||||
if ( mavenAccessToken == null || mavenRepositoryUrl == null ) {
|
|
||||||
throw new GradleScriptException("Missing required properties: MAVEN_PUBLISH_ACCESS_TOKEN and MAVEN_PUBLISH_REPOSITORY_URL", null)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply plugins
|
// Apply plugins
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
// Configure maven publish
|
if ( ext.mavenAccessToken == null || ext.mavenRepositoryUrl == null ) {
|
||||||
publishing {
|
logger.error("ERROR: Maven publish not possible! Missing required properties: MAVEN_PUBLISH_ACCESS_TOKEN and MAVEN_PUBLISH_REPOSITORY_URL")
|
||||||
publications {
|
}
|
||||||
bootJava(MavenPublication) {
|
else {
|
||||||
artifact tasks.named("bootJar")
|
// Configure maven publish
|
||||||
}
|
publishing {
|
||||||
}
|
publications {
|
||||||
repositories {
|
bootJava(MavenPublication) {
|
||||||
maven {
|
artifact tasks.named("bootJar")
|
||||||
name = "git.captica.de"
|
}
|
||||||
url uri(mavenRepositoryUrl)
|
}
|
||||||
|
repositories {
|
||||||
credentials(HttpHeaderCredentials) {
|
maven {
|
||||||
name = "Authorization"
|
name = "git.captica.de"
|
||||||
value = "token ${mavenAccessToken}"
|
url uri(mavenRepositoryUrl)
|
||||||
}
|
|
||||||
|
credentials(HttpHeaderCredentials) {
|
||||||
authentication {
|
name = "Authorization"
|
||||||
header(HttpHeaderAuthentication)
|
value = "token ${mavenAccessToken}"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
authentication {
|
||||||
|
header(HttpHeaderAuthentication)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user