Vert.x-Gradle-Simple is a Hello World [Vert.x 3.1](http://vertx.io/) project using the Gradle build system. It initializes an HTTP server which simply returns "Hello World!" with every request. It can be used on various platforms like Windows,Linux and Mac.
In this example, Vert.x is used in an embedded fashion. It uses Vert.x APIs directly in its classes rather than deploying code in verticles.
- Download Java 8 JDK for your Operating System.
- Make sure you have declared the
JAVA_HOMEenvironment variable to the directory where JDK was installed. - If not then declare it by following these steps
- Copy the path to jdk folder
C:\Program Files\Java\jdkx.x.x\binwhere x.x.x is the version number in your case. - Right Click on
This PCorMy Computerand SelectProperties. - In the Left Hand Corner Select
Advanced System Settings. - Click the button Environment Variables and make an Entry for JDK path in the path variable.
- Do not Remove previous Entries of the path variable
-
Fork the repository by clicking on the Fork icon at the top right corner of this page.
-
Clone the repository to your local machine by running the following command on git:
$ git clone https://github.com/[YOUR-USERNAME]/vertx-gradle-simple -
If you need help with this, refer Forking and Cloning in git. You can also ask for help on our gitter channel.
-
If not using Git, then simply download the .zip file of this repository and unzip the file.
-
Download Vert.x from http://vertx.io/
-
If you prefer using an IDE, install IntelliJ IDEA or any other preferred IDE for Java Application Development.
-
Configure Java SDK version by going to :
- File ---> Project Structure ---> Project Settings ---> Set the project SDK to Java version 1.8
- Import the cloned repository into your IDE
- Right click on the vertx at the top of the code and use the suggested help from IntelliJ to link it to the project
- Right click the HelloWorldEmbedded class
- Click Run as...
- Directly run the application using the gradle plugin in the command line with
./gradlew runon Linux/macOS ORgradlew runon Windows. If permission is denied, then run cmd as admin (for Windows) or usechmod +x ./gradlew(for Linux/Unix)
Visit http://localhost:8080 on your browser
If everything was setup correctly, you will see Hello World displayed in your browser.
You can try and edit the request handler response in the HelloWorldEmbedded java file.
- Make your intended changes on your locally cloned repository.
- Add a new branch with a meaningful name indicating your change (i.e. Add-Unit-Tests).
- Commit the changes and Push the commit to your forked repository on GitHub.
- Ensure the changes on the commit pushed to your GitHub fork are correct.
- Create a pull request requesting to merge the commits on your fork to this repository.
- Write a very conscise but informative pull request message. Remember to use your words wisely!