Java Academy

Master Java Development

Menu

Core Java

Servlets

JDBC

Microservices

Build Tools

APIs

Build Tools · Lesson 11

Continuous Integration Basics

What Continuous Integration Means

Continuous integration (CI) automatically builds and tests each proposed change. It shortens feedback loops and prevents a broken main branch from becoming the team's default state. A good pipeline is deterministic, visible, and fast enough to run frequently.

A CI-Friendly Java Check

The pipeline should run the same commands developers use locally, including compilation and tests. A small Java class illustrates that a build can make an explicit verification rather than only creating an artifact.

public class CiCheck {
    public static void main(String[] arguments) {
        int expectedLessonCount = 12;
        int actualLessonCount = 12;
        if (actualLessonCount != expectedLessonCount) {
            throw new IllegalStateException("Lesson count does not match the curriculum");
        }
        System.out.println("CI check passed");
    }
}

Pipeline Stages

StagePurposeFailure signal
CheckoutFetch the changeMissing revision
BuildCompile and resolve dependenciesCompiler error
TestVerify behaviorFailed assertion
QualityLint and scanPolicy violation
PackageProduce artifactMissing output

Common Mistake and Practices

Common Mistake: Letting CI silently ignore failed tests so the pipeline appears green. A green check should mean the configured quality gates actually ran and passed.

  • Pin tool and runtime versions.
  • Cache dependencies without hiding failures.
  • Publish test and coverage reports.
  • Keep credentials in CI secret storage.
  • Make failures actionable with logs.

Real-World Use Case

Every Java Academy pull request runs formatting, TypeScript checks, content validation, and the application build. Reviewers see failures before merging instead of discovering them after deployment.

Quiz Check

Quick Knowledge Test

Loading quiz questions...