From 9361a96820a6f92677533ba07facdfa822b0f18f Mon Sep 17 00:00:00 2001 From: laluondru Date: Thu, 17 Jun 2021 13:54:02 +0000 Subject: [PATCH 01/13] generating pom.xml --- my-app/{ => my-app}/pom.xml | 0 .../src/main/java/com/mycompany/app/App.java | 13 ++++++++++++ .../test/java/com/mycompany/app/AppTest.java | 20 +++++++++++++++++++ 3 files changed, 33 insertions(+) rename my-app/{ => my-app}/pom.xml (100%) create mode 100644 my-app/my-app/src/main/java/com/mycompany/app/App.java create mode 100644 my-app/my-app/src/test/java/com/mycompany/app/AppTest.java diff --git a/my-app/pom.xml b/my-app/my-app/pom.xml similarity index 100% rename from my-app/pom.xml rename to my-app/my-app/pom.xml diff --git a/my-app/my-app/src/main/java/com/mycompany/app/App.java b/my-app/my-app/src/main/java/com/mycompany/app/App.java new file mode 100644 index 0000000..77cf3e0 --- /dev/null +++ b/my-app/my-app/src/main/java/com/mycompany/app/App.java @@ -0,0 +1,13 @@ +package com.mycompany.app; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/my-app/my-app/src/test/java/com/mycompany/app/AppTest.java b/my-app/my-app/src/test/java/com/mycompany/app/AppTest.java new file mode 100644 index 0000000..81ac345 --- /dev/null +++ b/my-app/my-app/src/test/java/com/mycompany/app/AppTest.java @@ -0,0 +1,20 @@ +package com.mycompany.app; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * Unit test for simple App. + */ +public class AppTest +{ + /** + * Rigorous Test :-) + */ + @Test + public void shouldAnswerWithTrue() + { + assertTrue( true ); + } +} From 03a32c31c7fcf8df55cd51ca6f5a58a0c6c0bb52 Mon Sep 17 00:00:00 2001 From: Lalu Ondru <75995685+laluondru@users.noreply.github.com> Date: Mon, 21 Jun 2021 16:43:35 +0530 Subject: [PATCH 02/13] Create Jenkinsfile --- Jenkinsfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..e7fd639 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,26 @@ +pipeline { + agent any + stages { + stage('Init') { + steps { + echo 'Hi, this is Anshul from LevelUp360' + echo 'We are Starting the Testing' + } + } + stage('Build') { + steps { + echo 'Building Sample Maven Project' + } + } + stage('Deploy') { + steps { + echo "Deploying in Staging Area" + } + } + stage('Deploy Production') { + steps { + echo "Deploying in Production Area" + } + } + } +} From 61cd86ab8e95be12f4e62b87e2642b235a9eb06c Mon Sep 17 00:00:00 2001 From: Lalu Ondru <75995685+laluondru@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:14:38 +0530 Subject: [PATCH 03/13] Update Jenkinsfile --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index e7fd639..bf1371b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,6 +5,8 @@ pipeline { steps { echo 'Hi, this is Anshul from LevelUp360' echo 'We are Starting the Testing' + checkout([$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[credentialsId: 'laluondru', url: 'https://github.com/laluondru/java-app-with-maven.git']]]) + sh mvn "-Dmaven.test.failure.ignore=true clean package" } } stage('Build') { From 03f10d62172d49a6f549ebf4586a834072c04236 Mon Sep 17 00:00:00 2001 From: Lalu Ondru <75995685+laluondru@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:16:05 +0530 Subject: [PATCH 04/13] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index bf1371b..a0c943b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { echo 'Hi, this is Anshul from LevelUp360' echo 'We are Starting the Testing' checkout([$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[credentialsId: 'laluondru', url: 'https://github.com/laluondru/java-app-with-maven.git']]]) - sh mvn "-Dmaven.test.failure.ignore=true clean package" + sh "mvn -Dmaven.test.failure.ignore=true clean package" } } stage('Build') { From 184bcd155a31724c4b1aadd930f7a2aaccb3259d Mon Sep 17 00:00:00 2001 From: Lalu Ondru <75995685+laluondru@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:21:57 +0530 Subject: [PATCH 05/13] Update Jenkinsfile --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a0c943b..285c460 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,13 +5,14 @@ pipeline { steps { echo 'Hi, this is Anshul from LevelUp360' echo 'We are Starting the Testing' - checkout([$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[credentialsId: 'laluondru', url: 'https://github.com/laluondru/java-app-with-maven.git']]]) - sh "mvn -Dmaven.test.failure.ignore=true clean package" + } } stage('Build') { steps { echo 'Building Sample Maven Project' + checkout([$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[credentialsId: 'laluondru', url: 'https://github.com/laluondru/java-app-with-maven.git']]]) + sh "mvn -Dmaven.test.failure.ignore=true clean package" } } stage('Deploy') { From e18af417c3badd0c6826de5c69a845dc615d513b Mon Sep 17 00:00:00 2001 From: Lalu Ondru <75995685+laluondru@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:40:42 +0530 Subject: [PATCH 06/13] Update Jenkinsfile --- Jenkinsfile | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 285c460..7b0cd89 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,29 +1,33 @@ pipeline { - agent any - stages { - stage('Init') { - steps { - echo 'Hi, this is Anshul from LevelUp360' - echo 'We are Starting the Testing' - - } + agent any + + tools { + maven "maven" + jdk "jdk11" + } + + stages { + stage('Initialize'){ + steps{ + echo "PATH = ${M2_HOME}/bin:${PATH}" + echo "M2_HOME = /opt/maven" } - stage('Build') { - steps { - echo 'Building Sample Maven Project' - checkout([$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[credentialsId: 'laluondru', url: 'https://github.com/laluondru/java-app-with-maven.git']]]) - sh "mvn -Dmaven.test.failure.ignore=true clean package" - } - } - stage('Deploy') { - steps { - echo "Deploying in Staging Area" - } - } - stage('Deploy Production') { - steps { - echo "Deploying in Production Area" - } + } + stage('Build') { + steps { + dir("/var/lib/jenkins/workspace/New_demo/my-app") { + sh 'mvn -B -DskipTests clean package' + } + } + } + } + post { + always { + junit( + allowEmptyResults: true, + testResults: '*/test-reports/.xml' + ) } + } } From ba5df744d9f218041f51df98724790db88f07749 Mon Sep 17 00:00:00 2001 From: Lalu Ondru <75995685+laluondru@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:49:08 +0530 Subject: [PATCH 07/13] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7b0cd89..c8bcb17 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { tools { maven "maven" - jdk "jdk11" + jdk "jdk1.8.0_282" } stages { From 27649322c85ab0eae9396ac60a9ed676966a7d30 Mon Sep 17 00:00:00 2001 From: Lalu Ondru <75995685+laluondru@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:50:01 +0530 Subject: [PATCH 08/13] Update Jenkinsfile --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c8bcb17..fd8fcf1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,8 +3,7 @@ pipeline { tools { maven "maven" - jdk "jdk1.8.0_282" - } + } stages { stage('Initialize'){ From df7a5cb8299fbaf132675ac77c85a3c445e1a9c4 Mon Sep 17 00:00:00 2001 From: Lalu Ondru <75995685+laluondru@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:50:53 +0530 Subject: [PATCH 09/13] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index fd8fcf1..baaf840 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent any tools { - maven "maven" + maven "MAVEN" } stages { From 6f95ee51fef465633ed688b214c7ec59de3add5b Mon Sep 17 00:00:00 2001 From: Lalu Ondru <75995685+laluondru@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:52:50 +0530 Subject: [PATCH 10/13] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index baaf840..ba6d6e7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { } stage('Build') { steps { - dir("/var/lib/jenkins/workspace/New_demo/my-app") { + dir("/var/lib/jenkins/workspace/Maven-Jenkins222/my-app") { sh 'mvn -B -DskipTests clean package' } From 458338aec290a95c98b9fbdc9d30918b728b1ea2 Mon Sep 17 00:00:00 2001 From: Lalu Ondru <75995685+laluondru@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:55:26 +0530 Subject: [PATCH 11/13] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ba6d6e7..5fab4de 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { } stage('Build') { steps { - dir("/var/lib/jenkins/workspace/Maven-Jenkins222/my-app") { + dir("/var/lib/jenkins/workspace/Maven-Jenkins222/my-app/my-app") { sh 'mvn -B -DskipTests clean package' } From d7c6752df1404e40cc1bac5460d55f2bd9e36759 Mon Sep 17 00:00:00 2001 From: laluondru Date: Mon, 22 Nov 2021 19:10:42 +0530 Subject: [PATCH 12/13] test34 --- eaxmple.txt | 1 + echo.txt | 1 + sample.txt | 1 + testcase1.txt | 2 ++ 4 files changed, 5 insertions(+) create mode 100644 eaxmple.txt create mode 100644 echo.txt create mode 100644 sample.txt create mode 100644 testcase1.txt diff --git a/eaxmple.txt b/eaxmple.txt new file mode 100644 index 0000000..bfce019 --- /dev/null +++ b/eaxmple.txt @@ -0,0 +1 @@ +sampleprojecfffhhht diff --git a/echo.txt b/echo.txt new file mode 100644 index 0000000..1f38c8d --- /dev/null +++ b/echo.txt @@ -0,0 +1 @@ +this is a sample text file diff --git a/sample.txt b/sample.txt new file mode 100644 index 0000000..cc8f60d --- /dev/null +++ b/sample.txt @@ -0,0 +1 @@ +uhhh:wq: diff --git a/testcase1.txt b/testcase1.txt new file mode 100644 index 0000000..ebda4dd --- /dev/null +++ b/testcase1.txt @@ -0,0 +1,2 @@ + +hhfhfhfh From 11ca41657a8129abc694b6cbf25c81c614ecf9af Mon Sep 17 00:00:00 2001 From: laluondru Date: Mon, 22 Nov 2021 19:12:54 +0530 Subject: [PATCH 13/13] test34 --- testcase2.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 testcase2.txt diff --git a/testcase2.txt b/testcase2.txt new file mode 100644 index 0000000..92f5ff5 --- /dev/null +++ b/testcase2.txt @@ -0,0 +1 @@ +hhhhh