- About
- Stack
- Prerequisites
- Project Tree Details
- Usage Example - Running the App
- Usage Example - Running the Unit Test
- Code Editing and Modification Purpose
- CI / Pipeline Using Jenkins (Additional)
This 'Names Sorter App' is built to sort a List of Names by their Last Name from the desired file which is already available and located inside this project("unsorted-names-list.txt"), then we save the sorted result into another file ("sorted-names-list.txt").
-
Apache Maven => https://maven.apache.org/
-
Java => https://www.oracle.com/java/technologies/java-se-glance.html
-
JUnit5 (Unit Testing - already included with Maven project) => https://junit.org/junit5/
✅ No need 'specific IDEs'. Feel free to use any text editor to open the project folder.
✅ Straightforward and easy to use. Since we don't do repetitive activities
such as start, stop, or even restart the localhost/local server for this project.
✅ We check the application result on the Command Prompt / terminal by using mvn command
(you'll see it on below)
==> Please make sure that you have installed <==
a. Maven: https://maven.apache.org/install.html (size: ± 10MB)
b. Java 8 (minimum version)
Use these commands to check the Maven and Java version on your system
(runnable on both Windows and Linux):
mvn -v
java --version
💡 as i mentioned earlier, we don't want to be bothered by choosing specific IDEs/Text Editor
for running/opening this Java maven app.
💡 By using Maven (mvn) command through our cmd or terminal, we can run this app easily.
A: Directory where Main java files/classes located
B: Directory where Unit test files/classes located
C: resources for input("unsorted-names-list.txt") and output("sorted-names-list.txt").
You can modify the names as comprehensive and as many as you want inside the input file.
The output file content will be always overwritten based on your result.
a. Download or clone this repository to your local computer
b. Navigate to the location of this project that you just downloaded through command prompt(CMD) or Terminal.
Go to the path where pom.xml is located (inside haidar folder = root).
c. Then type or copy these commands on your command prompt or terminal
(Both of these commands runnable on Windows/Linux/Mac)
Remember to install Maven (and Java) first.
<!-- Run this code just ONCE, for installing the project's dependencies. -->
mvn compile && mvn clean install
Then run the app,
mvn exec:java -Dexec.mainClass=com.haidar.App
We can check and review the result.
a. same as above, just a little different command.
mvn test
a. Open the project folder with any IDE/Text Editor that you desired, i.e Sublime, Atom, VS Code, Notepad++, etc.
b. Explore and modify any Java files with its resources (the .txt files that contain names). You can also modify the unit test.
c. After you finish your editing process and you want to see the different result, you must re-run these commands again.
Before you execute this command, make sure to navigate at project's root directory where the pom.xml lies, so you can run the 'mvn' command.
<!-- For running the Main App (if you edited the main app, etc)-->
mvn exec:java -Dexec.mainClass=com.haidar.App
<!-- For running the Unit Test (if you edited the unit test) -->
mvn test
d. You can then see the modified result.
🦠If there's any issue regarding installation and debugging, kindly to inform me..