-
Notifications
You must be signed in to change notification settings - Fork 18
/
build-snapshot.jenkins
38 lines (27 loc) · 1.1 KB
/
build-snapshot.jenkins
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// must be executed on a docker-enabled node
node('docker-based-builds') {
// check out branch that triggered the build
stage('Checkout SCM') {
checkout scm
}
// load build environment docker container
def container = docker.image('caaqe/basic-build-environment:latest')
container.pull()
container.inside {
stage('Log Tool Versions') {
sh 'java -version'
sh 'git --version'
sh 'mvn --version'
sh 'gpg --version'
}
stage('Build & Deploy to Sonatype OSS') {
// credentials for the repository are stored in Jenkins
withCredentials([usernamePassword(credentialsId: 'ossrh-credentials', passwordVariable: 'ossrhPassword', usernameVariable: 'ossrhUsername')]) {
def skipTests = "-DskipTests=true"
def targetRepository = "-DaltDeploymentRepository=ossrh::default::https://oss.sonatype.org/content/repositories/snapshots"
def repositoryCredentials = "-Dossrh.username=${ossrhUsername} -Dossrh.password=${ossrhPassword}"
sh "./mvnw clean deploy ${skipTests} ${targetRepository} ${repositoryCredentials}"
}
}
}
}