From 66cee385e2a805d6b9ddb3f1d5903069857d65da Mon Sep 17 00:00:00 2001 From: Michael Jenkins Date: Fri, 1 Oct 2021 22:58:49 -0700 Subject: [PATCH] Add files for 03_01 --- 03_01.md | 27 +++++++++++++++++++-------- MAC_LINUX_DOCKER.md | 32 ++++++++++++++++++++++++++++++++ WINDOWS.md | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 MAC_LINUX_DOCKER.md create mode 100644 WINDOWS.md diff --git a/03_01.md b/03_01.md index c35c4e9..89e698e 100644 --- a/03_01.md +++ b/03_01.md @@ -1,4 +1,4 @@ -# Learning Jenkins, 03-01: Install Jenkins as a Container +# Learning Jenkins, 03-01: Using a global build tool # Prerequisites You will need to configure Maven as a global build tool. @@ -16,15 +16,26 @@ Create a freestyle job and configure it as follows: ``` https://github.com/managedkaos/apache-maven-hello-world ``` -2. *MAKE SURE TO SET THE `Branch Specifier` to `*/main`*. +2. **MAKE SURE TO SET THE `Branch Specifier` to `*/main`**. 3. Add a build step using `Invoke Top-Level Maven Target`. -4. For the goal, enter `package`. -5. Add a build step to run the compiled package: -- *FOR WINDOWS*: Use the `Execute Windows batch command` build step -- FOR macOS, Linux, and Docker: Use the `Execute shell` build step -6. Enter the following command: +4. Select the Maven version you configured in the previous step. +5. For the goal, enter `package`. + +# WINDOWS SYSTEMS +Select the `Execute Windows batch command` build step +``` +java -cp target/hello-1.0-SNAPSHOT.jar com.learningjenkins.App +``` +Save the job and start the build. + +[Follow this link for more details on Windows](WINDOWS.md) + + +# MacOS, Linux, and Docker +Select the `Execute shell` build step. ``` java -cp target/hello-1.0-SNAPSHOT.jar com.learningjenkins.App ``` -7. Save the job and start a build. +Save the job and start the build. +[Follow this link for more details on MacOS, Linux, and Docker](MAC_LINUX_DOCKER.md) diff --git a/MAC_LINUX_DOCKER.md b/MAC_LINUX_DOCKER.md new file mode 100644 index 0000000..11b0ddf --- /dev/null +++ b/MAC_LINUX_DOCKER.md @@ -0,0 +1,32 @@ +# Learning Jenkins, 03-01: Using a global build tool + +# Prerequisites +You will need to configure Maven as a global build tool. + +In the Jenkins web interface, go to: + +`Manage Jenkins` -> `Global Tool Configuration` -> `Maven installations` -> `Add Maven`. + +Give your Maven installation a name and check the option to `Install automatically`. + +# Setting up the Jenkins Job +Create a freestyle job and configure it as follows: + +1. Under `Source Code Management`, select `Git` and enter the following URL: +``` +https://github.com/managedkaos/apache-maven-hello-world +``` +2. **MAKE SURE TO SET THE `Branch Specifier` to `*/main`**. +3. Add a build step using `Invoke Top-Level Maven Target`. +4. Select the Maven version you configured in the previous step. +5. For the goal, enter `package`. + +# MacOS, Linux, and Docker +Select the `Execute shell` build step. +``` +java -cp target/hello-1.0-SNAPSHOT.jar com.learningjenkins.App +``` +Save the job and start the build. + +# Troubleshooting Errors + diff --git a/WINDOWS.md b/WINDOWS.md new file mode 100644 index 0000000..a610aee --- /dev/null +++ b/WINDOWS.md @@ -0,0 +1,32 @@ +# Learning Jenkins, 03-01: Using a global build tool + +# Prerequisites +You will need to configure Maven as a global build tool. + +In the Jenkins web interface, go to: + +`Manage Jenkins` -> `Global Tool Configuration` -> `Maven installations` -> `Add Maven`. + +Give your Maven installation a name and check the option to `Install automatically`. + +# Setting up the Jenkins Job +Create a freestyle job and configure it as follows: + +1. Under `Source Code Management`, select `Git` and enter the following URL: +``` +https://github.com/managedkaos/apache-maven-hello-world +``` +2. **MAKE SURE TO SET THE `Branch Specifier` to `*/main`**. +3. Add a build step using `Invoke Top-Level Maven Target`. +4. Select the Maven version you configured in the previous step. +5. For the goal, enter `package`. + +# WINDOWS SYSTEMS +Select the `Execute Windows batch command` build step +``` +java -cp target/hello-1.0-SNAPSHOT.jar com.learningjenkins.App +``` +Save the job and start the build. + +# Troubleshooting Errors +