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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
| pipeline {
agent any
environment {
NEXUS_VERSION = "nexus2"
NEXUS_PROTOCOL = "http"
NEXUS_URL = "***"
NEXUS_REPOSITORY = "***"
NEXUS_CREDENTIAL_ID = "373c4e8a-83db-4025-933e-a29b052e088c"
}
tools {
maven "maven_3.8.4"
jdk "jdk11"
}
stages {
stage('Git pull'){
steps{
git branch: 'dev', credentialsId: '2caf8590-ce9d-4317-a6a4-7153b872eb58',url: 'https://***.git'
}
}
stage('Junit'){
steps{
sh "mvn clean test"
}
post{
success{
junit 'target/surefire-reports/*.xml'
}
}
}
stage('Jacoco'){
steps{
sh "mvn clean deploy -U -DargLine=-javaagent:/home/jacocoagent.jar -Dmaven.test.failure.ignore=true -Dmaven.test.skip=false"
jacoco()
}
}
stage('Build') {
steps {
sh "mvn package -DskipTests"
sh "mvn dependency:copy-dependencies -DoutputDirectory=target/lib"
sh "mvn source:jar"
}
post {
success {
archiveArtifacts 'target/*.jar'
}
}
}
stage('Upload nexus'){
steps {
script {
pom = readMavenPom file: "pom.xml";
nexusArtifactUploader(
nexusVersion: NEXUS_VERSION,
protocol: NEXUS_PROTOCOL,
nexusUrl: NEXUS_URL,
groupId: pom.groupId,
version: pom.version,
repository: NEXUS_REPOSITORY,
credentialsId: NEXUS_CREDENTIAL_ID,
artifacts: [
[artifactId: pom.artifactId,
classifier: '',
file: "target/${pom.artifactId}-${pom.version}.${pom.packaging}",
type: pom.packaging],
[artifactId: pom.artifactId,
classifier: 'sources',
file: "target/${pom.artifactId}-${pom.version}-sources.${pom.packaging}",
type: pom.packaging]
])
}
}
}
stage('Clean workspace') {
steps{
deleteDir()
}
}
}
}
|