For any version of Solr prior to Solr 9.0, the build system used is based on Ant/Ivy.

(warning) Solr 9.0 and later must be built with Gradle, Ant is no longer supported on trunk/9.0 as of late August, 2020

We've had a long run using Ant, but Gradle offers significant advantages so we changed the build system. Any version of Solr prior to 9.0 must be built with Ant, there will be no attempt to backport the Gradle build system to 8x or earlier.

If you're building Solr 8x or earlier for the first time, here are the steps you need to follow:


cd where_you_cloned_the_repository

Issue any of the following commands.

'ant -projecthelp ' will show the available build targets

'ant ivy-bootstrap' will install ivy

cd solr

'ant usage' will show the available build targets

'ant server' will build a runnable Solr (note, 'ant example' is the target pre 5.x)

'ant dist' will build the libraries you might want to link against from, say, a SolrJ program.

'ant package' will build files like 'package/solr-5.2.0-SNAPSHOT-src.tgz' which are standard distributions you can install somewhere else just like an official release.

'ant test' will run all of the unit tests. NOTE: this takes quite a while.

NOTE: If your build hangs when building and especially on a "resolve" step, it's probably because there are left over lock files in your ivy directory (often because you crtl-c'd during a build). To fix this navigate to your .ivy2 directory and delete all of the "*.lck" files in the tree. For *nix operating systems, issue a command similar to:
find . -name "*.lck" | xargs rm

(warning) The "ant" package that is part of recent versions of Redhat Linux (and other operating systems derived from Redhat, like CentOS) has some problems with Lucene/Solr source code. On these systems, downloading ant from Apache's website is necessary. If the broken package is installed, you can type 'export ANT_HOME=/path/to/ant' at the bash prompt to point at the downloaded version. There's no need to put the downloaded directory on your PATH, you can use the ant executable provided by the broken package. The presence of the ANT_HOME variable will ignore the broken package and fully switch ant over to the downloaded version.