Getting the source code
Clone the repository from GitHub:Prerequisites
Install JDK 25
Lucene 11.0 requires JDK 25 as the minimum Java version. You can obtain it from any of the following providers:Confirm your version before proceeding:
Install Perl and Python 3
Some build tasks — in particular
./gradlew check — require Perl and Python 3. Install them using your system’s package manager if they are not already present.Building with Gradle
The Gradle wrapper handles everything needed to build the project from scratch. On first run it creates agradle.properties file with machine-specific settings that can be left as-is in most cases.
To see a summary of typical workflow tasks:
Code formatting
Lucene enforces google-java-format conventions for all Java source files. After modifying source files, run:Wildcard imports are banned but
google-java-format does not detect or fix them. The pre-commit check (uvx prek) will catch them. See Pre-commit validation below.Running tests
Run all tests and validations
Run all tests and validations
This is the command to run before submitting a contribution. It assembles Lucene and runs all validation tasks, including tests:To run validations but skip tests:
Run tests for a specific module
Run tests for a specific module
Use the Or use the full Gradle project path:
-p flag to target a module by its directory path:Run a single test class or method
Run a single test class or method
Run tests with verbose output
Run tests with verbose output
Run tests with a fixed random seed
Run tests with a fixed random seed
Lucene tests use randomization. To reproduce a failure, pass the seed reported in the failing test:
Pre-commit validation
Lucene uses prek for fast pre-commit checks. It lints Markdown files, Python scripts, shell scripts, and more. Run checks on staged changes:The
--allow-missing-config option is required if you also work on older release branches that do not yet support prek.Writing tests for bug fixes
Lucene uses the randomizedtesting framework. Place test classes alongside the source they exercise, following the existing naming conventions in the module you are working in.Creating a patch or pull request
Opening a pull request
Open your pull request against themain branch on github.com/apache/lucene. Committers will backport accepted changes to maintenance branches where applicable.
Make your changes
Apply your fix or feature. Run
./gradlew tidy to format code and ./gradlew check to verify everything passes.Add a CHANGES entry
Open the pull request
Push your branch and open a PR on GitHub. Refer to GitHub’s pull request documentation if needed.
Creating a patch (alternative)
If you prefer to attach a patch to an issue rather than opening a PR:- Keep your
mainbranch up to date with upstream:git pull. - Generate a patch with
git difforgit format-patch. - Rename the file from
XXX.patchtoXXX.patch.txt— GitHub does not accept.patchattachments directly. - Attach the file to the relevant GitHub issue.
You do not need to create a patch if you have already opened a pull request.
IDE support
IntelliJ IDEA
IntelliJ IDEA
Import the project as a Gradle project — it should work out of the box.For faster test execution, configure IntelliJ to use its own built-in test runner: navigate to File → Settings → Build, Execution, Deployment → Build Tools → Gradle and set both “Build and run using” and “Run tests using” to IntelliJ IDEA.Note: some tests are designed to run only via the Gradle wrapper and will not work under the built-in runner.
Eclipse
Eclipse
Generate Eclipse project files:Then import the project with File → Import → Existing Project into Workspace.Note: Eclipse does not distinguish between sub-projects and source sets, so all sources and dependencies appear in one combined view.
VSCode
VSCode
Generate the Eclipse-compatible project files (VSCode uses the same setup):Then open the Lucene checkout directory in VSCode.
Staying involved
Contributors should join the Lucene mailing lists:- Users list (
java-user@lucene.apache.org) — get help and help others. - Developers list (
dev@lucene.apache.org) — discuss design and upcoming changes. - Commits list (
commits@lucene.apache.org) — see changes as they land.
Finding a first issue
New contributors looking for a good starting point should look for issues that:- Have not had any work done yet.
- Are unlikely to be controversial.
- Are self-contained with limited scope.
good first issue or help wanted.