Requirements
| Requirement | Version |
|---|---|
| JDK | 25 or later |
| Git | Any recent version |
| Perl | Any recent version (required by some validation tasks) |
| Python 3 | Any recent version (required by some validation tasks) |
OpenJDK
The upstream OpenJDK builds from Oracle.
Adoptium Temurin
Community-maintained Eclipse Temurin builds.
Azul Zulu
Azul-supported OpenJDK distribution.
Oracle JDK
Official Oracle JDK downloads.
Cloning the repository
Using the Gradle wrapper
The Gradle wrapper downloads the correct version of Gradle automatically on first run and caches it locally. On Windows usegradlew.bat.
gradle.properties file with machine-specific settings. This file can be left as-is in most cases.
Common build tasks
Assemble JARs
Build JARs for all Lucene modules:Run all tests and validations
Run tests only
Generate Javadoc
Generate API documentation for a single module:Auto-format code
Reformat all Java source files to comply with google-java-format conventions:./gradlew check to avoid formatting failures.
Show workflow help
Print a summary of typical workflow commands:Running tests for a specific module
- By directory path
- By full project path
- Single test class
- Pattern match
Distribution artifacts
To create all distributable packages, POMs, and a local Maven repository for inspection:Testing against a different JVM
By default tests run with the same JVM used by Gradle. To run tests against a different Java installation, set theruntime.java.home property or the RUNTIME_JAVA_HOME environment variable:
gradle.properties.
IDE setup
IntelliJ IDEA
IntelliJ IDEA
Import the project as a Gradle project from the root
build.gradle file. IntelliJ detects the Gradle project structure automatically.By default IntelliJ delegates test runs to the Gradle wrapper, which is correct but can be slower. For faster test iteration you can switch to the built-in runner:- Open File → Settings → Build, Execution, Deployment → Build Tools → Gradle.
- Set “Build and run using” to IntelliJ IDEA.
- Set “Run tests using” to IntelliJ IDEA.
Some Lucene tests are designed to run only via the Gradle wrapper and will fail or be skipped under the built-in runner.
Eclipse
Eclipse
Generate Eclipse project files using Gradle:Then import with File → Import → Existing Project into Workspace.Note: Eclipse does not distinguish between sub-projects and source sets (main/test), so all sources and dependencies appear together in a single project view.
VSCode
VSCode
Run the same Eclipse setup step:Then open the root
lucene directory in VSCode. The Java extension will pick up the project structure.GitHub Codespaces
GitHub Codespaces
Fork the
apache/lucene repository, then browse to https://github.com/codespaces/new, select your fork, and click Create codespace. The repository opens in a browser-based VS Code environment with Java pre-installed.Quick reference
| Task | Command |
|---|---|
| Build all JARs | ./gradlew assemble |
| Run all tests and checks | ./gradlew check |
| Run tests only | ./gradlew test |
| Test a single module | ./gradlew :lucene:core:test |
| Auto-format code | ./gradlew tidy |
| Generate Javadoc (core) | ./gradlew -p lucene/core javadoc |
| Generate full docs site | ./gradlew documentation |
| Create Maven artifacts | ./gradlew mavenLocal |
| Show workflow help | ./gradlew helpWorkflow |
| Show all help topics | ./gradlew help |