Fundamentals 7 min read

Boost Java Code Quality: How to Use SonarLint, SonarQube, and Alibaba Plugin

This article introduces three essential code‑quality tools—SonarLint, SonarQube, and the Alibaba code‑convention plugin—explaining their installation, basic usage, integration with Maven, and how they help developers detect code smells, enforce standards, and quantify quality metrics in Java projects.

Java Backend Technology
Java Backend Technology
Java Backend Technology
Boost Java Code Quality: How to Use SonarLint, SonarQube, and Alibaba Plugin

Today we recommend three plugins that act as code‑quality detection power‑tools: SonarLint, SonarQube, and the Alibaba code‑convention plugin.

1. SonarLint

SonarLint is a code‑quality detection plugin that helps identify code smells directly in the IDE.

Download & Install

To analyze a single file or project, right‑click → Analyze → Analyze with SonarLint, or select files/folders and use the menu Analyze → Analyze with SonarLint.

You can also disable specific rules:

When custom rules need to be synchronized, bind SonarLint to SonarQube:

View analysis results:

Warnings should not be ignored:

SonarLint provides examples and solutions for each issue, such as preferring LocalDate, LocalTime, LocalDateTime, eliminating duplicate code, avoiding potential NPEs, and reducing nested loops.

With a quality‑check tool, metrics like bug rate and code duplication become quantifiable, enabling custom dashboards for managers.

2. SonarQube

SonarQube is an open‑source code‑quality management platform.

Unzip & Start Locally

unzip sonarqube-7.7.zip
cd sonarqube-7.7
bin/[OS]/sonar.sh console

After a successful start, open http://localhost:9000 and log in with the default admin credentials (admin/admin).

To send analysis results to the server, configure a SonarScanner. See the official documentation.

Example Maven configuration (add to pom.xml):

<build>
    <plugins>
        <plugin>
            <groupId>org.sonarsource.scanner.maven</groupId>
            <artifactId>sonar-maven-plugin</artifactId>
            <version>3.6.0.1398</version>
        </plugin>
    </plugins>
</build>

Run analysis with: mvn clean compile sonar:sonar Successful execution shows output like:

Refresh http://localhost:9000 to see the updated dashboard.

In production, data should be persisted to a database; see the installation guide for details.

3. Alibaba Code‑Convention Plugin

The Alibaba Java coding standards are widely used. Install the plugin in IDEA to automatically scan for violations.

After installation, the plugin detects "bad" code and highlights issues.

Example of detection results:

For more details, refer to the original article at cnblogs.com/cjsblog/p/10735800.html .

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Javamavencode qualitystatic analysisSonarQubesonarlintAlibaba plugin
Java Backend Technology
Written by

Java Backend Technology

Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.