forked from thamunkpillai/webapplication
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignment_3
More file actions
40 lines (38 loc) · 1.36 KB
/
assignment_3
File metadata and controls
40 lines (38 loc) · 1.36 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
pipeline{
agent any
tools{
jdk 'java_home'
maven 'maven_home'
}
parameters{
gitParameter(branch: '', branchFilter: '.*', defaultValue: 'master', description: 'enter the branch name', name: 'branch', quickFilterEnabled: false, selectedValue: 'NONE', sortMode: 'NONE', tagFilter: '*', type: 'PT_BRANCH')
string(defaultValue: '', description: 'accept the string', name: 'git_url', trim: false)
}
stages{
stage(checkout){
steps{
echo 'checking out the code'
checkout([$class: 'GitSCM',
branches: [[name: "${params.branch}"]],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [[url: "${params.git_url}"]]])
}
}
stage(build){
steps{
echo 'building the war file'
//tool name: 'java_home', type: 'jdk'
//tool name: 'maven_home', type: 'maven'
sh 'mvn clean install'
}
}
stage(deploy){
steps{
echo "deploying the war file"
sh 'cp /var/lib/jenkins/workspace/myfirstproject/target/java-tomcat-maven-example.war /var/lib/tomcat/webapps/'
}
}
}
}