Last active
February 18, 2020 17:20
-
-
Save danieldietrich/c585d0c6217591fc67485faa344f3c78 to your computer and use it in GitHub Desktop.
Gradle maven-publish problem as described here: https://twitter.com/danieldietrich/status/1229794465981829123
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
/* | |
* --> in-house Artifactory server here <-- | |
*/ | |
gradlePluginPortal() | |
} | |
dependencies { | |
classpath "io.spring.gradle:dependency-management-plugin:${versionSpringDependencyManagementPlugin}" | |
classpath "net.researchgate:gradle-release:${versionGradleReleasePlugin}" | |
classpath "org.springframework.boot:spring-boot-gradle-plugin:${versionSpringBoot}" | |
classpath "org.springframework.boot:spring-boot-loader-tools:${versionSpringBoot}" | |
} | |
} | |
repositories { | |
mavenLocal() // needed for publishToMavenLocal | |
mavenCentral() | |
} | |
group = 'my.fancy.group' | |
// build | |
apply plugin: 'java-library' | |
apply plugin: 'maven-publish' | |
apply plugin: 'net.researchgate.release' | |
// ide | |
apply plugin: 'eclipse' | |
apply plugin: 'idea' | |
// spring | |
apply plugin: 'io.spring.dependency-management' | |
apply plugin: 'org.springframework.boot' | |
tasks.withType(JavaCompile) { | |
sourceCompatibility = 8 | |
targetCompatibility = 8 | |
options.encoding = 'UTF-8' | |
options.compilerArgs = [ '-Werror', '-Xlint:all' ] | |
} | |
jar.enabled = true | |
bootJar.enabled = false | |
dependencies { | |
implementation "ch.qos.logback:logback-classic:${versionLogbackClassic}" | |
implementation 'org.springframework.boot:spring-boot-starter-web' | |
testImplementation 'org.springframework.boot:spring-boot-starter' | |
testImplementation 'org.springframework.boot:spring-boot-starter-test' | |
} | |
publishing { | |
publications { | |
mavenJava(MavenPublication) { | |
artifactId = project.name | |
from components.java | |
pom { | |
name = project.name | |
description = "bla bla" | |
url = 'http://fancy/stuff/' | |
inceptionYear = '2020' | |
scm { | |
connection = 'scm:git:https://github.com/xyz/lib-logging.git' | |
developerConnection = 'scm:git:https://github.com/xyz/lib-logging.git' | |
url = 'https://github.com/xyz/lib-logging/tree/master' | |
} | |
} | |
} | |
} | |
repositories { | |
maven { | |
/* | |
def releasesRepoUrl = 'http://xyz/artifactory/releases' | |
def snapshotsRepoUrl = 'http://xyz/artifactory/snapshots' | |
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl | |
credentials { | |
username findProperty('artifactoryUsername') | |
password findProperty('artifactoryPassword') | |
} | |
*/ | |
url = "$buildDir/repo" | |
} | |
} | |
} | |
release { | |
buildTasks = ['build'] | |
tagTemplate = '$name-$version' | |
git { | |
requireBranch = '' | |
pushToRemote = 'origin' | |
pushToCurrentBranch = true | |
} | |
} | |
afterReleaseBuild.dependsOn publish |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version=0.0.5-SNAPSHOT | |
versionGradleReleasePlugin=2.8.1 | |
versionLogbackClassic=1.2.3 | |
versionSpringBoot=2.2.4.RELEASE | |
versionSpringDependencyManagementPlugin=1.0.9.RELEASE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment