Compare commits

...

14 Commits
main ... 03_01

Author SHA1 Message Date
  Michael 3355be560d Update version for maven.compiler; update repo URL for win and macos 1 year ago
  Michael Jenkins 9f823d05e7 2 years ago
  Spencer Nicholls 43e930afe0
Delete 03_01.md 4 years ago
  Michael f4e0d5cc86
Update MAC_LINUX_DOCKER.md 4 years ago
  Michael f3b70b9610
Update MAC_LINUX_DOCKER.md 4 years ago
  Michael f74fa95892
Update WINDOWS.md 4 years ago
  Michael 430fb7f0c8
Update README.md 4 years ago
  Michael Jenkins adc81bbf16 Copy main content to README 4 years ago
  Michael Jenkins eae2ea59dd Update the repo URL 4 years ago
  Michael Jenkins e470e55a92 Update for private repo configuration 4 years ago
  Michael Jenkins 28b90236c5 Add source to Hello-Maven 4 years ago
  Michael Jenkins 66cee385e2 Add files for 03_01 4 years ago
  Michael Jenkins a30a40c2a5 Add steps for configuring git 4 years ago
  Michael Jenkins a9e729cbc0 Add steps for 03-01 4 years ago
15 changed files with 261 additions and 58 deletions
Split View
  1. +0
    -0
      .github/CODEOWNERS
  2. +0
    -34
      .github/ISSUE_TEMPLATE.md
  3. +0
    -0
      .github/PULL_REQUEST_TEMPLATE.md
  4. +0
    -0
      .github/workflows/main.yml
  5. +0
    -0
      .gitignore
  6. +0
    -0
      CONTRIBUTING.md
  7. +0
    -0
      LICENSE
  8. +33
    -0
      MAC_LINUX_DOCKER.md
  9. +44
    -0
      NOTES.md
  10. +0
    -0
      NOTICE
  11. +42
    -24
      README.md
  12. +34
    -0
      WINDOWS.md
  13. +75
    -0
      pom.xml
  14. +13
    -0
      src/main/java/com/learningjenkins/App.java
  15. +20
    -0
      src/test/java/com/learningjenkins/AppTest.java

+ 0
- 0
.github/CODEOWNERS View File


+ 0
- 34
.github/ISSUE_TEMPLATE.md View File

@ -1,34 +0,0 @@
<!--
BEFORE POSTING YOUR ISSUE:
- These comments won't show up when you submit the issue.
- Please use the sections below to provide information about the issue.
- Be specific: Add as much detail as possible.
-->
## Issue Overview
<!-- A brief overview of the issue --->
## Describe your environment
<!-- Provide details about your environment: what editor, browser, and other software you are using and any other specifics to your setup -->
## Steps to Reproduce
<!-- Provide an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant. Include a live link if available. -->
1.
2.
3.
4.
## Expected Behavior
<!-- What behavior did you expect? -->
## Current Behavior
<!-- What happened instead of the expected behavior? Describe the difference. -->
## Possible Solution
<!-- Optional: Do you have a fix or a suggestion on how to fix the issue? -->
## Screenshots / Video
<!-- Optional: Add any screenshots or video of the issue if available. -->
## Related Issues
<!-- List related issues -->

+ 0
- 0
.github/PULL_REQUEST_TEMPLATE.md View File


+ 0
- 0
.github/workflows/main.yml View File


+ 0
- 0
.gitignore View File


+ 0
- 0
CONTRIBUTING.md View File


+ 0
- 0
LICENSE View File


+ 33
- 0
MAC_LINUX_DOCKER.md View File

@ -0,0 +1,33 @@
# 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/LinkedInLearning/learning-jenkins-3003221
```
1. **MAKE SURE TO SET THE `Branch Specifier` to `*/03_01`**.
1. Add a build step using `Invoke Top-Level Maven Target`.
1. Select the Maven version you configured in the previous step.
1. For the goal, enter `package`.
1. Add a build step using the `Execute shell` build step and enter:
```
java -cp target/hello-1.0-SNAPSHOT.jar com.learningjenkins.App
```
1. Save the job and start the build.
## Troubleshooting Errors
```
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
```
This error means you have probably entered the wrong branch under Source Code Management. You need to enter `*/03_01` for the branch.

+ 44
- 0
NOTES.md View File

@ -0,0 +1,44 @@
# Apache Maven 'Hello World!'
This is a small project for demonstrating the Apache Maven build management tool.
## Getting Started
You will need to have the following tools installed on your system:
- Git
- Java
- Maven
The following versions were used to create, build, and test this project:
```
# git --version
git version 2.33.0
# java -version
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12-46)
OpenJDK 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)
# mvn -version
Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)
Maven home: /usr/local/Cellar/maven/3.8.2/libexec
Java version: 16.0.2, vendor: Homebrew, runtime: /usr/local/Cellar/openjdk/16.0.2/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "11.4", arch: "x86_64", family: "mac"
```
These versions are not a requirement but are provided to provide some visibility into the build environment needed to run this project.
## Building the Project with Maven
To build the project with Maven, clone the repo and run the following command inside the repo:
```
mvn package
```
## Testing the Project with Java
The project includes a [very simple test](src/test/java/com/learningjenkins/AppTest.java) that demonstrates an assertion that will always pass.
To test the packaged code, build the code and run the following command inside the repo:
```
java -cp target/hello-1.0-SNAPSHOT.jar com.learningjenkins.App
```

+ 0
- 0
NOTICE View File


+ 42
- 24
README.md View File

@ -1,34 +1,52 @@
# Learning Jenkins
This is the repository for the LinkedIn Learning course `Learning Jenkins`. The full course is available from [LinkedIn Learning][lil-course-url].
# Learning Jenkins, 03-01: Using a global build tool
_See the readme file in the main branch for updated instructions and information._
## Instructions
This repository has branches for each of the videos in the course. You can use the branch pop up menu in github to switch to a specific branch and take a look at the course at that stage, or you can add `/tree/BRANCH_NAME` to the URL to go to the branch you want to access.
## Prerequisites
You will need to configure Maven as a global build tool.
## Branches
The branches are structured to correspond to the videos in the course. The naming convention is `CHAPTER#_MOVIE#`. As an example, the branch named `02_03` corresponds to the second chapter and the third video in that chapter.
Some branches will have a beginning and an end state. These are marked with the letters `b` for "beginning" and `e` for "end". The `b` branch contains the code as it is at the beginning of the movie. The `e` branch contains the code as it is at the end of the movie. The `main` branch holds the final state of the code when in the course.
In the Jenkins web interface, go to:
When switching from one exercise files branch to the next after making changes to the files, you may get a message like this:
`Manage Jenkins` -> `Tools` -> `Maven installations` -> `Add Maven`.
error: Your local changes to the following files would be overwritten by checkout: [files]
Please commit your changes or stash them before you switch branches.
Aborting
Give your Maven installation a name and check the option to `Install automatically`.
To resolve this issue:
Add changes to git using this command: git add .
Commit changes using this command: git commit -m "some message"
Select the `Save` button.
## Installing
1. To use these exercise files, you must have the following installed:
- [list of requirements for course]
2. Clone this repository into your local machine using the terminal (Mac), CMD (Windows), or a GUI tool like SourceTree.
3. [Course-specific instructions]
## 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/LinkedInLearning/learning-jenkins-3003221
```
2. **MAKE SURE TO SET THE `Branch Specifier` to `*/03_01`**.
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`.
[0]: # (Replace these placeholder URLs with actual course URLs)
## WINDOWS SYSTEMS
Select `Add build step` -> `Execute Windows batch command`.
[lil-course-url]: https://www.linkedin.com/learning/
[lil-thumbnail-url]: http://
Enter:
```
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 `Add build step` -> `Execute shell`.
Enter:
```
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 MacOS, Linux, and Docker](MAC_LINUX_DOCKER.md)
## Troubleshooting Errors
```
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
```
This error means you have probably entered the wrong branch under Source Code Management. You need to enter `*/03_01` for the branch.

+ 34
- 0
WINDOWS.md View File

@ -0,0 +1,34 @@
# 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/LinkedInLearning/learning-jenkins-3003221
```
2. **MAKE SURE TO SET THE `Branch Specifier` to `*/03_01`**.
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`.
6. Add a new build step using the `Execute Windows batch command` and enter
```
java -cp target/hello-1.0-SNAPSHOT.jar com.learningjenkins.App
```
Save the job and start the build.
## Troubleshooting Errors
```
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
```
This error means you have probably entered the wrong branch under Source Code Management. You need to enter `*/03_01` for the branch.

+ 75
- 0
pom.xml View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.learningjenkins</groupId>
<artifactId>hello</artifactId>
<version>1.0-SNAPSHOT</version>
<name>hello</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

+ 13
- 0
src/main/java/com/learningjenkins/App.java View File

@ -0,0 +1,13 @@
package com.learningjenkins;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

+ 20
- 0
src/test/java/com/learningjenkins/AppTest.java View File

@ -0,0 +1,20 @@
package com.learningjenkins;
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 );
}
}

Loading…
Cancel
Save