diff --git a/NOTES.md b/NOTES.md new file mode 100644 index 0000000..e9634b6 --- /dev/null +++ b/NOTES.md @@ -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 +``` diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..407b22a --- /dev/null +++ b/pom.xml @@ -0,0 +1,75 @@ + + + + 4.0.0 + + com.learningjenkins + hello + 1.0-SNAPSHOT + + hello + + http://www.example.com + + + UTF-8 + 1.7 + 1.7 + + + + + junit + junit + 4.11 + test + + + + + + + + + maven-clean-plugin + 3.1.0 + + + + maven-resources-plugin + 3.0.2 + + + maven-compiler-plugin + 3.8.0 + + + maven-surefire-plugin + 2.22.1 + + + maven-jar-plugin + 3.0.2 + + + maven-install-plugin + 2.5.2 + + + maven-deploy-plugin + 2.8.2 + + + + maven-site-plugin + 3.7.1 + + + maven-project-info-reports-plugin + 3.0.0 + + + + + diff --git a/src/main/java/com/learningjenkins/App.java b/src/main/java/com/learningjenkins/App.java new file mode 100644 index 0000000..04f0a47 --- /dev/null +++ b/src/main/java/com/learningjenkins/App.java @@ -0,0 +1,13 @@ +package com.learningjenkins; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/src/test/java/com/learningjenkins/AppTest.java b/src/test/java/com/learningjenkins/AppTest.java new file mode 100644 index 0000000..3562032 --- /dev/null +++ b/src/test/java/com/learningjenkins/AppTest.java @@ -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 ); + } +}