Skip to content

mansimg/vertx-gradle-simple

 
 

Repository files navigation

Vert.x 3.1 Simplest Gradle Project

Codacy Badge Build Status

What is Vert.x-Gradle-Simple

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.

Setting up the project

  • Download Java 8 JDK for your Operating System.
  • Make sure you have declared the JAVA_HOME environment variable to the directory where JDK was installed.
  • If not then declare it by following these steps
  1. Copy the path to jdk folder C:\Program Files\Java\jdkx.x.x\bin where x.x.x is the version number in your case.
  2. Right Click on This PC or My Computer and Select Properties.
  3. In the Left Hand Corner Select Advanced System Settings.
  4. Click the button Environment Variables and make an Entry for JDK path in the path variable.
  5. 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 are using an IDE, skip steps 1 and 2
  1. If you prefer using an IDE, install IntelliJ IDEA or any other preferred IDE for Java Application Development.

  2. Configure Java SDK version by going to :

    • File ---> Project Structure ---> Project Settings ---> Set the project SDK to Java version 1.8

Running the app

Choose any ONE Method:

1. Using an IDE like IntelliJ IDEA,
  • 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...
2. Command Line Method
  • Directly run the application using the gradle plugin in the command line with ./gradlew run on Linux/macOS OR gradlew run on Windows. If permission is denied, then run cmd as admin (for Windows) or use chmod +x ./gradlew (for Linux/Unix)

Viewing the app after running it

Visit http://localhost:8080 on your browser

If everything was setup correctly, you will see Hello World displayed in your browser.

Playing with the code

You can try and edit the request handler response in the HelloWorldEmbedded java file.

Contributing to the project

  1. Make your intended changes on your locally cloned repository.
  2. Add a new branch with a meaningful name indicating your change (i.e. Add-Unit-Tests).
  3. Commit the changes and Push the commit to your forked repository on GitHub.
  4. Ensure the changes on the commit pushed to your GitHub fork are correct.
  5. Create a pull request requesting to merge the commits on your fork to this repository.
  6. Write a very conscise but informative pull request message. Remember to use your words wisely!

Addtional Learning

About

Simple vertex gradle app

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 100.0%