2011-05-09 11:45:27 -04:00
|
|
|
====================================
|
|
|
|
Lucene/Solr Maven build instructions
|
|
|
|
====================================
|
|
|
|
|
|
|
|
Contents:
|
|
|
|
|
|
|
|
A. How to use nightly Jenkins-built Lucene/Solr Maven artifacts
|
2012-03-03 18:41:38 -05:00
|
|
|
B. How to generate Maven artifacts
|
|
|
|
C. How to deploy Maven artifacts to a repository
|
2011-05-09 11:45:27 -04:00
|
|
|
D. How to use Maven to build Lucene/Solr
|
|
|
|
|
|
|
|
-----
|
|
|
|
|
|
|
|
A. How to use nightly Jenkins-built Lucene/Solr Maven artifacts
|
|
|
|
|
|
|
|
The most recently produced nightly Jenkins-built Lucene and Solr Maven
|
2012-03-03 18:41:38 -05:00
|
|
|
snapshot artifacts are available in the Apache Snapshot repository here:
|
|
|
|
|
|
|
|
http://repository.apache.org/snapshots
|
|
|
|
|
2011-07-25 18:28:15 -04:00
|
|
|
An example POM snippet:
|
2012-03-03 18:41:38 -05:00
|
|
|
|
2011-07-25 18:28:15 -04:00
|
|
|
<project ...>
|
|
|
|
...
|
|
|
|
<repositories>
|
|
|
|
...
|
|
|
|
<repository>
|
2012-03-03 18:41:38 -05:00
|
|
|
<id>apache.snapshots</id>
|
|
|
|
<name>Apache Snapshot Repository</name>
|
|
|
|
<url>http://repository.apache.org/snapshots</url>
|
|
|
|
<releases>
|
|
|
|
<enabled>false</enabled>
|
|
|
|
</releases>
|
2011-07-25 18:28:15 -04:00
|
|
|
</repository>
|
2011-05-09 11:45:27 -04:00
|
|
|
|
2011-05-09 12:09:28 -04:00
|
|
|
|
2012-03-03 18:41:38 -05:00
|
|
|
B. How to generate Lucene/Solr Maven artifacts
|
|
|
|
|
2013-03-18 08:28:52 -04:00
|
|
|
Prerequisites: JDK 1.7+ and Ant 1.8.2+
|
2011-05-09 11:45:27 -04:00
|
|
|
|
2012-03-03 18:41:38 -05:00
|
|
|
Run 'ant generate-maven-artifacts' to create an internal Maven
|
|
|
|
repository, including POMs, binary .jars, source .jars, and javadoc
|
|
|
|
.jars.
|
2011-05-09 11:45:27 -04:00
|
|
|
|
2012-08-07 16:47:05 -04:00
|
|
|
You can run the above command in three possible places: the top-level
|
|
|
|
directory; under lucene/; or under solr/. From the top-level directory
|
|
|
|
or from lucene/, the internal repository will be located at dist/maven/.
|
|
|
|
From solr/, the internal repository will be located at package/maven/.
|
2011-05-09 11:45:27 -04:00
|
|
|
|
|
|
|
|
2012-03-03 18:41:38 -05:00
|
|
|
C. How to deploy Maven artifacts to a repository
|
2011-05-09 11:45:27 -04:00
|
|
|
|
2013-03-18 08:28:52 -04:00
|
|
|
Prerequisites: JDK 1.7+ and Ant 1.8.2+
|
2011-05-09 11:45:27 -04:00
|
|
|
|
2012-08-07 16:47:05 -04:00
|
|
|
You can deploy targets for all of Lucene/Solr, only Lucene, or only Solr,
|
|
|
|
as in B. above. To deploy to a Maven repository, the command is the same
|
|
|
|
as in B. above, with the addition of two system properties:
|
2011-05-09 11:45:27 -04:00
|
|
|
|
2012-03-03 18:41:38 -05:00
|
|
|
ant -Dm2.repository.id=my-repo-id \
|
|
|
|
-Dm2.repository.url=http://example.org/my/repo \
|
|
|
|
generate-maven-artifacts
|
2011-05-09 11:45:27 -04:00
|
|
|
|
2012-03-03 18:41:38 -05:00
|
|
|
The repository ID given in the above command corresponds to a <server>
|
|
|
|
entry in either your ~/.m2/settings.xml or ~/.ant/settings.xml. See
|
|
|
|
<http://maven.apache.org/settings.html#Servers> for more information.
|
|
|
|
(Note that as of version 2.1.3, Maven Ant Tasks cannot handle encrypted
|
|
|
|
passwords.)
|
2011-05-09 11:45:27 -04:00
|
|
|
|
|
|
|
|
|
|
|
D. How to use Maven to build Lucene/Solr
|
|
|
|
|
|
|
|
In summary, to enable Maven builds, perform the following:
|
|
|
|
|
|
|
|
svn update
|
|
|
|
ant get-maven-poms
|
2012-05-08 00:33:02 -04:00
|
|
|
cd maven-build
|
2011-05-09 11:45:27 -04:00
|
|
|
|
|
|
|
The details, followed by some example Maven commands:
|
|
|
|
|
2014-01-29 13:03:24 -05:00
|
|
|
1. Prerequisites: JDK 1.7+ and Maven 2.2.1 or 3.X
|
2011-05-09 11:45:27 -04:00
|
|
|
|
|
|
|
2. Make sure your sources are up to date. If you checked your sources out
|
|
|
|
from the Apache Subversion repository, run "svn update" from the top
|
|
|
|
level.
|
|
|
|
|
2012-05-08 00:33:02 -04:00
|
|
|
3. Copy the Maven POM templates from under dev-tools/maven/ to the
|
|
|
|
maven-build/ directory using the following command from the top-level
|
|
|
|
directory:
|
2011-05-09 11:45:27 -04:00
|
|
|
|
|
|
|
ant get-maven-poms
|
|
|
|
|
|
|
|
Note that you will need to do this whenever changes to the POM
|
|
|
|
templates are committed. It's a good idea to follow every "svn update"
|
|
|
|
with "ant get-maven-poms" for this reason.
|
|
|
|
|
|
|
|
The above command copies all of the POM templates from dev-tools/maven/,
|
|
|
|
filling in the project version with the default "X.X-SNAPSHOT". If you
|
|
|
|
want the POMs and the Maven-built artifacts to have a version other than
|
|
|
|
the default, you can supply an alternate version on the command line
|
2014-01-29 13:03:24 -05:00
|
|
|
with the above command, e.g. "my-special-version":
|
2011-05-09 11:45:27 -04:00
|
|
|
|
2012-08-07 16:47:05 -04:00
|
|
|
ant -Dversion=my-special-version get-maven-poms
|
2011-05-09 11:45:27 -04:00
|
|
|
|
2014-01-29 13:03:24 -05:00
|
|
|
or to append "my-special-version" to the current base version, e.g. 5.0,
|
|
|
|
resulting in version "5.0-my-special-version":
|
|
|
|
|
|
|
|
ant -Ddev.version.suffix=my-special-version get-maven-poms
|
|
|
|
|
2012-05-30 12:22:31 -04:00
|
|
|
Note: if you change the version in the POMs, there is one test method
|
|
|
|
that will fail under maven-surefire-plugin:
|
|
|
|
o.a.l.index.TestCheckIndex#testLuceneConstantVersion(). It's safe to
|
|
|
|
@Ignore this test method, since it's just comparing the value of the
|
|
|
|
lucene.version system property (set in the maven-surefire-plugin
|
|
|
|
configuration in the lucene-core POM) against a hard-wired official
|
|
|
|
version (o.a.l.util.Constants.LUCENE_MAIN_VERSION).
|
|
|
|
|
2012-05-08 00:33:02 -04:00
|
|
|
4. To remove the maven-build/ directory and its contents, use the following
|
|
|
|
command from the top-level directory:
|
|
|
|
|
2012-05-30 11:53:04 -04:00
|
|
|
ant clean-maven-build
|
2012-05-08 00:33:02 -04:00
|
|
|
|
2011-05-09 12:09:28 -04:00
|
|
|
|
2011-05-09 11:45:27 -04:00
|
|
|
Some example Maven commands you can use after you perform the above
|
|
|
|
preparatory steps:
|
|
|
|
|
2011-07-25 18:28:15 -04:00
|
|
|
- Compile, package, and install all binary artifacts to your local
|
|
|
|
repository:
|
2011-05-09 11:45:27 -04:00
|
|
|
|
|
|
|
mvn install
|
|
|
|
|
|
|
|
After compiling and packaging, but before installing each module's
|
|
|
|
artifact, the above command will also run all the module's tests.
|
|
|
|
|
2011-07-25 18:28:15 -04:00
|
|
|
- Compile, package, and install all binary artifacts to your local
|
|
|
|
repository, without running any tests:
|
2011-05-09 11:45:27 -04:00
|
|
|
|
|
|
|
mvn -DskipTests install
|
|
|
|
|
2011-07-25 18:28:15 -04:00
|
|
|
- Compile, package, and install all binary and source artifacts to your
|
|
|
|
local repository, without running any tests:
|
|
|
|
|
|
|
|
mvn -DskipTests source:jar-no-fork install
|
|
|
|
|
|
|
|
- Run all tests:
|
2011-05-09 11:45:27 -04:00
|
|
|
|
|
|
|
mvn test
|
|
|
|
|
2011-07-25 18:28:15 -04:00
|
|
|
- Run all test methods defined in a test class:
|
2011-05-09 11:45:27 -04:00
|
|
|
|
|
|
|
mvn -Dtest=TestClassName test
|