Last active
November 27, 2019 19:38
-
-
Save Alykoff/ca6dd2f39746875deaf0 to your computer and use it in GitHub Desktop.
gradle build with release plugins net.researchgate.release (clean assemble artifactoryPublish)
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
import net.researchgate.release.GitAdapter | |
import java.util.regex.Matcher | |
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1" | |
} | |
} | |
plugins { | |
id 'net.researchgate.release' version '2.1.2' | |
id "com.jfrog.artifactory" version "3.1.1" | |
id 'maven-publish' | |
id 'java' | |
} | |
group 'com.example.common' | |
description = 'Importer from excel files' | |
sourceCompatibility = 1.8 | |
targetCompatibility = 1.8 | |
compileJava.options.encoding = 'UTF-8' | |
task wrapper(type: Wrapper) { | |
gradleVersion = '2.5' | |
} | |
publishing { | |
publications { | |
mavenJava(MavenPublication) { | |
from components.java | |
artifact(file("$rootDir/gradle.properties")) | |
} | |
} | |
} | |
artifactory { | |
contextUrl = "https://dev.example.com/artifactory" | |
publish { | |
repository { | |
repoKey = version.endsWith('SNAPSHOT') ? 'weblab-snapshot-local' : 'weblab-release-local' | |
username = "${mavenUsername}" | |
password = "${mavenPassword}" | |
maven = true | |
} | |
defaults { | |
publishArtifacts = true | |
publications('mavenJava') | |
publishPom = true // Publish generated POM files to Artifactory (true by default) | |
} | |
} | |
resolve { | |
repository { | |
repoKey = version.endsWith('SNAPSHOT') ? 'weblab-snapshot-local' : 'weblab-release-local' | |
username = "${mavenUsername}" | |
password = "${mavenPassword}" | |
maven = true | |
} | |
} | |
} | |
repositories { | |
mavenCentral() | |
mavenLocal() | |
maven { | |
credentials { | |
username = "${mavenUsername}" | |
password = "${mavenPassword}" | |
} | |
url "https://dev.example.com/artifactory/weblab-release-local" | |
} | |
maven { | |
credentials { | |
username = "${mavenUsername}" | |
password = "${mavenPassword}" | |
} | |
url "https://dev.example.com/artifactory/weblab-snapshot-local" | |
} | |
} | |
dependencies { | |
// test | |
testCompile "junit:junit:${junitVersion}" | |
} | |
release { | |
preCommitText = '' | |
preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit' | |
tagCommitMessage = '[Gradle Release Plugin] - creating tag' | |
newVersionCommitMessage = '[Gradle Release Plugin] - new snashot version release' | |
tagTemplate = '${version}' | |
versionPropertyFile = 'gradle.properties' | |
versionProperties = [] | |
versionPatterns = [ | |
/(\d+)([^\d]*$)/: { | |
Matcher m, Project p -> m.replaceAll("${(m[0][1] as int) + 1}${m[0][2]}") | |
} | |
] | |
scmAdapters = [GitAdapter] | |
git { | |
requireBranch = 'master' | |
pushToRemote = 'origin' | |
pushToCurrentBranch = false | |
} | |
} | |
afterReleaseBuild.dependsOn artifactoryPublish |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment