forked from sudheer76R/java-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkins_jfrog
More file actions
46 lines (42 loc) · 1.28 KB
/
Jenkins_jfrog
File metadata and controls
46 lines (42 loc) · 1.28 KB
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
pipeline{
agent {label 'build'}
environment {
//ARTIFACTORY_URL = 'https://my-artifactory.com'
ARTIFACTORY_REPO = 'maven'
//ARTIFACTORY_CREDENTIALS_ID = 'artifactory-credentials-id' // Jenkins credentials ID
}
stages{
stage('Git Checkout Stage'){
steps{
git branch: 'main', url: 'https://github.com/Divyamarathi/java-example.git'
}
}
stage('Build Stage'){
steps{
sh 'mvn clean install'
}
}
/* stage('SonarQube Analysis Stage') {
steps{
withSonarQubeEnv('sonarqube-server') {
sh "mvn clean verify sonar:sonar"
}
}
}*/
stage('Publish Artifacts') {
steps {
script {
// Publish the artifact to Artifactory
def server = Artifactory.server('jfrog')
def uploadSpec = """{
"files": [{
"pattern": "target/*.war",
"target": "maven/java_example.war"
}]
}"""
server.upload(uploadSpec)
}
}
}
}
}