- Gradle Commands Cheat Sheet
- Gradle Run Command Line
- Gradle Commands Cheat Sheet Pdf
- Gradle Commands Cheat Sheet Pdf
This post is about how-to integrate SonarQube into your Gradle powered development process with Docker and Jenkins.
“SonarQube - The leading product for Continuous Code Quality”
Complete the steps described in the rest of this page to create a simple Java command-line application that makes requests to the Google Sheets API. To run this quickstart, you need the following prerequisites: Java 1.8 or greater; Gradle 2.3 or greater. A Google account Step 1: Turn on the Google Sheets API. Dzone: build a java app with gradle; Playing with gradle; Gradle Cheat Sheets¶ Gradle Cheat Sheets; SDKMAN¶ SdkMan is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. It provides a convenient Command Line Interface (CLI) and API for installing, switching, removing and listing Candidates. Below is the IntelliJ Cheat sheet for commands mentioned which perform different kinds of operations: Command. This command is used to Comment Line. Ctrl + Shift + /. It is used to Comment Block. It is to Duplicate Line.
Gradle with SonarQube
Integrating SonarQube into your Gradle build is as easy as adding the plugin org.sonarqube with:
and running the command
./gradlew sonarqube
.Add the System property -Dsonar.host.url=http://<hostname>:<port>
in case your service is not running locally… Since this wouldn’t be worth a post I decided to add two bonus chapters ;-)
Bonus I: Run SonarQube with Docker Compose
In the following Setup, we’ll use the official Docker image for SonarQube: sonarqube.
![Gradle Commands Cheat Sheet Gradle Commands Cheat Sheet](/uploads/1/3/7/3/137353452/373333814.jpeg)
The main piece infrastructure wise is the
docker-compose.yaml
file:With
docker-compose up sonarqube
you can spin up your local SonarQube which will be available on port 9000
Gradle Commands Cheat Sheet
Tip: If you want to use a PostgreSQL as backend you might want to have a look at our post Using a PostgreSQL with Docker like a Pro covering the database part of this scenario. Chrome design.
You’ll also need to configure the database connection in your sonar environment:
Bonus II: Run SonarQube behind NGinx
In case you want a simple basic authentication before your SonarQube instance you can add the following snippet to your NGinx configuration:
location ^~ /sonar { proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Authorization '; auth_basic “SonarQube”; auth_basic_user_file /etc/sonarqube/htaccess; proxy_pass http://127.0.0.1:9000; }
Gradle Run Command Line
Note: Did you spot the
Authorization ';
header, which gave me some headaches…?!Gradle Commands Cheat Sheet Pdf
In the
docker-compose.yaml
we added a command: -Dsonar.web.context=/sonar
to be passed to the entry point to change the context to match our NGinx location.Gradle Commands Cheat Sheet Pdf
Safer coding…with Quality Gates