This project is a simple calculator application developed using Java and Spring Boot. It is designed to demonstrate the basic functionalities of a calculator, including addition, subtraction, multiplication, and division. The project also showcases the integration with Jenkins for continuous integration and delivery (CI/CD), making it an excellent starting point for learning Jenkins.
- Perform basic arithmetic operations: addition, subtraction, multiplication, and division.
- RESTful API endpoints for each operation.
- Spring Boot framework for easy project setup and management.
- Maven for project building and dependencies management.
- Jenkins integration for automating build, test, and deployment processes.
Before you begin, ensure you have met the following requirements:
- Java JDK 11 or newer installed.
- Maven installed.
- Jenkins installed and configured.
- Git installed for version control.
To get a local copy up and running, follow these simple steps:
-
Clone the repository
git clone https://github.com/NCherfaoui/jenkins-first-project.git
-
Navigate to the project directory
cd jenkins-first-project
-
Build the project
./mvnw clean install
-
Run the application
./mvnw spring-boot:run
The application should now be running and accessible locally.
Access the calculator functionalities through the following RESTful endpoints:
- Addition:
GET /calculator/add?a={num1}&b={num2}
- Subtraction:
GET /calculator/subtract?a={num1}&b={num2}
- Multiplication:
GET /calculator/multiply?a={num1}&b={num2}
- Division:
GET /calculator/divide?a={num1}&b={num2}
Replace {num1}
and {num2}
with the numbers you wish to calculate.
The Jenkinsfile
included in the project root directory outlines the pipeline for continuous integration, including stages for checkout, build, test, and package. To use this pipeline:
- Create a new Jenkins job and select "Pipeline" as the job type.
- Configure the source code management to point to the project's repository.
- Paste the contents of the
Jenkinsfile
into the Pipeline script section.
Run the job to automate the build, test, and packaging of the application.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Project Link: https://github.com/NCherfaoui/jenkins-first-project