Skip to content
Open
47 changes: 47 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
pipeline {
agent any
tools {
// Install the Maven version configured as "M3" and add it to the path.
maven "M3"
}
stages {
stage ('Checkout') {
steps {
git branch: 'main',
url: 'https://github.com/rudranshrocks7/pipelines-java.git'
}
}
stage('Build') {
steps {
sh "mvn -Dmaven.test.failure.ignore=true clean package"
}
}
stage('Install') {
steps {
sh "mvn install"
}
}
stage ('Deploy') {
when {
branch 'main'
}
steps {
echo "Deploying"
deploy adapters: [tomcat9 (
credentialsId: 'tomcat',
path: '',
url: 'http://74.249.99.250:8088/'
)],
contextPath: 'finalTest',
onFailure: 'false',
war: '**/*.war'
}
post {
success {
junit '**/target/surefire-reports/TEST-*.xml'
archiveArtifacts 'target/*.war'
}
}
}
}
}
4 changes: 2 additions & 2 deletions src/main/java/com/microsoft/demo/Demo.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
public class Demo {
public void DoSomething(boolean flag){
if(flag){
System.out.println("I am covered");
System.out.println("I am covered Yes");
return;
}

System.out.println("I am not covered");
}
}
}