diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..628f2a1f1 --- /dev/null +++ b/Jenkinsfile @@ -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' + } + } + } + } +} diff --git a/src/main/java/com/microsoft/demo/Demo.java b/src/main/java/com/microsoft/demo/Demo.java index 3ab319fe3..01d240b55 100644 --- a/src/main/java/com/microsoft/demo/Demo.java +++ b/src/main/java/com/microsoft/demo/Demo.java @@ -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"); } -} \ No newline at end of file +}