File: building.rst

package info (click to toggle)
apache-arrow 23.0.1-1
  • links: PTS
  • area: main
  • in suites: sid
  • size: 76,220 kB
  • sloc: cpp: 654,608; python: 70,522; ruby: 45,964; ansic: 18,742; sh: 7,365; makefile: 669; javascript: 125; xml: 41
file content (624 lines) | stat: -rw-r--r-- 23,666 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
.. Licensed to the Apache Software Foundation (ASF) under one
.. or more contributor license agreements.  See the NOTICE file
.. distributed with this work for additional information
.. regarding copyright ownership.  The ASF licenses this file
.. to you under the Apache License, Version 2.0 (the
.. "License"); you may not use this file except in compliance
.. with the License.  You may obtain a copy of the License at

..   http://www.apache.org/licenses/LICENSE-2.0

.. Unless required by applicable law or agreed to in writing,
.. software distributed under the License is distributed on an
.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
.. KIND, either express or implied.  See the License for the
.. specific language governing permissions and limitations
.. under the License.

.. highlight:: console

.. _building-arrow-java:

===================
Building Arrow Java
===================

.. contents::

System Setup
============

Arrow Java uses the `Maven <https://maven.apache.org/>`_ build system.

Building requires:

* JDK 11+
* Maven 3+

.. note::
    CI will test all supported JDK LTS versions, plus the latest non-LTS version.

Building
========

All the instructions below assume that you have cloned the Arrow git
repository:

.. code-block::

    $ git clone https://github.com/apache/arrow.git
    $ cd arrow
    $ git submodule update --init --recursive

These are the options available to compile Arrow Java modules with:

* Maven build tool.
* Docker Compose.
* Archery.

Building Java Modules
---------------------

To build the default modules, go to the project root and execute:

Maven
~~~~~

.. code-block:: text

    $ cd arrow/java
    $ export JAVA_HOME=<absolute path to your java home>
    $ java --version
    $ mvn clean install

Docker compose
~~~~~~~~~~~~~~

.. code-block:: text

    $ cd arrow/java
    $ export JAVA_HOME=<absolute path to your java home>
    $ java --version
    $ docker compose run java

Archery
~~~~~~~

.. code-block:: text

    $ cd arrow/java
    $ export JAVA_HOME=<absolute path to your java home>
    $ java --version
    $ archery docker run java

Building JNI Libraries (\*.dylib / \*.so / \*.dll)
--------------------------------------------------

First, we need to build the `C++ shared libraries`_ that the JNI bindings will use.
We can build these manually or we can use `Archery`_ to build them using a Docker container
(This will require installing Docker, Docker Compose, and Archery).

.. note::
   If you are building on Apple Silicon, be sure to use a JDK version that was compiled
   for that architecture. See, for example, the `Azul JDK <https://www.azul.com/downloads/?os=macos&architecture=arm-64-bit&package=jdk>`_.

   If you are building on Windows OS, see :ref:`Developing on Windows <developers-cpp-windows>`.

Maven
~~~~~

- To build only the JNI C Data Interface library (macOS / Linux):

  .. code-block:: text

      $ cd arrow/java
      $ export JAVA_HOME=<absolute path to your java home>
      $ java --version
      $ mvn generate-resources -Pgenerate-libs-cdata-all-os -N
      $ ls -latr ../java-dist/lib
      |__ arrow_cdata_jni/

- To build only the JNI C Data Interface library (Windows):

  .. code-block:: text

      $ cd arrow/java
      $ mvn generate-resources -Pgenerate-libs-cdata-all-os -N
      $ dir "../java-dist/bin"
      |__ arrow_cdata_jni/

- To build all JNI libraries (macOS / Linux) except the JNI C Data Interface library:

  .. code-block:: text

      $ cd arrow/java
      $ export JAVA_HOME=<absolute path to your java home>
      $ java --version
      $ mvn generate-resources -Pgenerate-libs-jni-macos-linux -N
      $ ls -latr java-dist/lib
      |__ arrow_dataset_jni/
      |__ arrow_orc_jni/
      |__ gandiva_jni/

- To build all JNI libraries (Windows) except the JNI C Data Interface library:

  .. code-block:: text

      $ cd arrow/java
      $ mvn generate-resources -Pgenerate-libs-jni-windows -N
      $ dir "../java-dist/bin"
      |__ arrow_dataset_jni/

CMake
~~~~~

- To build only the JNI C Data Interface library (macOS / Linux):

  .. code-block:: text

      $ cd arrow
      $ mkdir -p java-dist java-cdata
      $ cmake \
          -S java \
          -B java-cdata \
          -DARROW_JAVA_JNI_ENABLE_C=ON \
          -DARROW_JAVA_JNI_ENABLE_DEFAULT=OFF \
          -DBUILD_TESTING=OFF \
          -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_INSTALL_PREFIX=java-dist
      $ cmake --build java-cdata --target install --config Release
      $ ls -latr java-dist/lib
      |__ arrow_cdata_jni/

- To build only the JNI C Data Interface library (Windows):

  .. code-block:: text

      $ cd arrow
      $ mkdir java-dist, java-cdata
      $ cmake ^
          -S java ^
          -B java-cdata ^
          -DARROW_JAVA_JNI_ENABLE_C=ON ^
          -DARROW_JAVA_JNI_ENABLE_DEFAULT=OFF ^
          -DBUILD_TESTING=OFF ^
          -DCMAKE_BUILD_TYPE=Release ^
          -DCMAKE_INSTALL_PREFIX=java-dist
      $ cmake --build java-cdata --target install --config Release
      $ dir "java-dist/bin"
      |__ arrow_cdata_jni/

- To build all JNI libraries (macOS / Linux) except the JNI C Data Interface library:

  .. code-block:: text

      $ cd arrow
      $ brew bundle --file=cpp/Brewfile
      # Homebrew Bundle complete! 25 Brewfile dependencies now installed.
      $ brew uninstall aws-sdk-cpp
      #  (We can't use aws-sdk-cpp installed by Homebrew because it has
      #  an issue: https://github.com/aws/aws-sdk-cpp/issues/1809 )
      $ export JAVA_HOME=<absolute path to your java home>
      $ mkdir -p java-dist cpp-jni
      $ cmake \
          -S cpp \
          -B cpp-jni \
          -DARROW_BUILD_SHARED=OFF \
          -DARROW_CSV=ON \
          -DARROW_DATASET=ON \
          -DARROW_DEPENDENCY_SOURCE=BUNDLED \
          -DARROW_DEPENDENCY_USE_SHARED=OFF \
          -DARROW_FILESYSTEM=ON \
          -DARROW_GANDIVA=ON \
          -DARROW_GANDIVA_STATIC_LIBSTDCPP=ON \
          -DARROW_JSON=ON \
          -DARROW_ORC=ON \
          -DARROW_PARQUET=ON \
          -DARROW_S3=ON \
          -DARROW_SUBSTRAIT=ON \
          -DARROW_USE_CCACHE=ON \
          -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_INSTALL_PREFIX=java-dist \
          -DCMAKE_UNITY_BUILD=ON
      $ cmake --build cpp-jni --target install --config Release
      $ cmake \
          -S java \
          -B java-jni \
          -DARROW_JAVA_JNI_ENABLE_C=OFF \
          -DARROW_JAVA_JNI_ENABLE_DEFAULT=ON \
          -DBUILD_TESTING=OFF \
          -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_INSTALL_PREFIX=java-dist \
          -DCMAKE_PREFIX_PATH=$PWD/java-dist \
          -DProtobuf_ROOT=$PWD/../cpp-jni/protobuf_ep-install \
          -DProtobuf_USE_STATIC_LIBS=ON
      $ cmake --build java-jni --target install --config Release
      $ ls -latr java-dist/lib/
      |__ arrow_dataset_jni/
      |__ arrow_orc_jni/
      |__ gandiva_jni/

- To build all JNI libraries (Windows) except the JNI C Data Interface library:

  .. code-block:: text

      $ cd arrow
      $ mkdir java-dist, cpp-jni
      $ cmake ^
          -S cpp ^
          -B cpp-jni ^
          -DARROW_BUILD_SHARED=OFF ^
          -DARROW_CSV=ON ^
          -DARROW_DATASET=ON ^
          -DARROW_DEPENDENCY_USE_SHARED=OFF ^
          -DARROW_FILESYSTEM=ON ^
          -DARROW_GANDIVA=OFF ^
          -DARROW_JSON=ON ^
          -DARROW_ORC=ON ^
          -DARROW_PARQUET=ON ^
          -DARROW_S3=ON ^
          -DARROW_SUBSTRAIT=ON ^
          -DARROW_USE_CCACHE=ON ^
          -DARROW_WITH_BROTLI=ON ^
          -DARROW_WITH_LZ4=ON ^
          -DARROW_WITH_SNAPPY=ON ^
          -DARROW_WITH_ZLIB=ON ^
          -DARROW_WITH_ZSTD=ON ^
          -DCMAKE_BUILD_TYPE=Release ^
          -DCMAKE_INSTALL_PREFIX=java-dist ^
          -DCMAKE_UNITY_BUILD=ON ^
          -GNinja
      $ cd cpp-jni
      $ ninja install
      $ cd ../
      $ cmake ^
          -S java ^
          -B java-jni ^
          -DARROW_JAVA_JNI_ENABLE_C=OFF ^
          -DARROW_JAVA_JNI_ENABLE_DATASET=ON ^
          -DARROW_JAVA_JNI_ENABLE_DEFAULT=ON ^
          -DARROW_JAVA_JNI_ENABLE_GANDIVA=OFF ^
          -DARROW_JAVA_JNI_ENABLE_ORC=ON ^
          -DBUILD_TESTING=OFF ^
          -DCMAKE_BUILD_TYPE=Release ^
          -DCMAKE_INSTALL_PREFIX=java-dist ^
          -DCMAKE_PREFIX_PATH=$PWD/java-dist
      $ cmake --build java-jni --target install --config Release
      $ dir "java-dist/bin"
      |__ arrow_orc_jni/
      |__ arrow_dataset_jni/

Archery
~~~~~~~

.. code-block:: text

    $ cd arrow
    $ archery docker run java-jni-manylinux-2014
    $ ls -latr java-dist
    |__ arrow_cdata_jni/
    |__ arrow_dataset_jni/
    |__ arrow_orc_jni/
    |__ gandiva_jni/

Building Java JNI Modules
-------------------------

- To compile the JNI bindings, use the ``arrow-c-data`` Maven profile:

  .. code-block:: text

      $ cd arrow/java
      $ mvn -Darrow.c.jni.dist.dir=<absolute path to your arrow folder>/java-dist/lib -Parrow-c-data clean install

- To compile the JNI bindings for ORC / Gandiva / Dataset, use the ``arrow-jni`` Maven profile:

  .. code-block:: text

      $ cd arrow/java
      $ mvn \
          -Darrow.cpp.build.dir=<absolute path to your arrow folder>/java-dist/lib/ \
          -Darrow.c.jni.dist.dir=<absolute path to your arrow folder>/java-dist/lib/ \
          -Parrow-jni clean install

Testing
=======

By default, Maven uses the same Java version to both build the code and run the tests.

It is also possible to use a different JDK version for the tests. This requires Maven
toolchains to be configured beforehand, and then a specific test property needs to be set.

Configuring Maven toolchains
----------------------------

To be able to use a JDK version for testing, it needs to be registered first in Maven ``toolchains.xml``
configuration file usually located under ``${HOME}/.m2`` with the following snippet added to it:

  .. code-block:: xml

      <?xml version="1.0" encoding="UTF8"?>
      <toolchains>

        [...]

        <toolchain>
          <type>jdk</type>
          <provides>
            <version>21</version> <!-- Replace with the corresponding JDK version: 11, 17, ... -->
            <vendor>temurin</vendor> <!-- Replace with the vendor/distribution: temurin, oracle, zulu ... -->
          </provides>
          <configuration>
            <jdkHome>path/to/jdk/home</jdkHome> <!-- Replace with the path to the JDK -->
          </configuration>
        </toolchain>

        [...]

      </toolchains>

Testing with a specific JDK
---------------------------

To run Arrow tests with a specific JDK version, use the ``arrow.test.jdk-version`` property.

For example, to run Arrow tests with JDK 17, use the following snippet:

  .. code-block:: text

      $ cd arrow/java
      $ mvn -Darrow.test.jdk-version=17 clean verify

IDE Configuration
=================

IntelliJ
--------

To start working on Arrow in IntelliJ: build the project once from the command
line using ``mvn clean install``. Then open the ``java/`` subdirectory of the
Arrow repository, and update the following settings:

* In the Files tool window, find the path ``vector/target/generated-sources``,
  right click the directory, and select Mark Directory as > Generated Sources
  Root. There is no need to mark other generated sources directories, as only
  the ``vector`` module generates sources.
* For JDK 11, due to an `IntelliJ bug
  <https://youtrack.jetbrains.com/issue/IDEA-201168>`__, you must go into
  Settings > Build, Execution, Deployment > Compiler > Java Compiler and disable
  "Use '--release' option for cross-compilation (Java 9 and later)". Otherwise
  you will get an error like "package sun.misc does not exist".
* You may want to disable error-prone entirely if it gives spurious
  warnings (disable both error-prone profiles in the Maven tool window
  and "Reload All Maven Projects").
* If using IntelliJ's Maven integration to build, you may need to change
  ``<fork>`` to ``false`` in the pom.xml files due to an `IntelliJ bug
  <https://youtrack.jetbrains.com/issue/IDEA-278903>`__.
* To enable debugging JNI-based modules like ``dataset``,
  activate specific profiles in the Maven tab under "Profiles".
  Ensure the profiles ``arrow-c-data``, ``arrow-jni``, ``generate-libs-cdata-all-os``,
  ``generate-libs-jni-macos-linux``, and ``jdk11+`` are enabled, so that the
  IDE can build them and enable debugging.

You may not need to update all of these settings if you build/test with the
IntelliJ Maven integration instead of with IntelliJ directly.

Common Errors
=============

* When working with the JNI code: if the C++ build cannot find dependencies, with errors like these:

  .. code-block:: text

     Could NOT find Boost (missing: Boost_INCLUDE_DIR system filesystem)
     Could NOT find Lz4 (missing: LZ4_LIB)
     Could NOT find zstd (missing: ZSTD_LIB)

  Specify that the dependencies should be downloaded at build time (more details at `Dependency Resolution`_):

  .. code-block:: text

     -Dre2_SOURCE=BUNDLED \
     -DBoost_SOURCE=BUNDLED \
     -Dutf8proc_SOURCE=BUNDLED \
     -DSnappy_SOURCE=BUNDLED \
     -DORC_SOURCE=BUNDLED \
     -DZLIB_SOURCE=BUNDLED

.. _Archery: https://github.com/apache/arrow/blob/main/dev/archery/README.md
.. _Dependency Resolution: https://arrow.apache.org/docs/developers/cpp/building.html#individual-dependency-resolution
.. _C++ shared libraries: https://arrow.apache.org/docs/cpp/build_system.html


Installing Nightly Packages
===========================

.. warning::
    These packages are not official releases. Use them at your own risk.

Arrow nightly builds are posted on the mailing list at `builds@arrow.apache.org`_.
The artifacts are uploaded to GitHub. For example, for 2022/07/30, they can be found at `GitHub Nightly`_.


Installing from Apache Nightlies
--------------------------------
1. Look up the nightly version number for the Arrow libraries used.

   For example, for ``arrow-memory``, visit  https://nightlies.apache.org/arrow/java/org/apache/arrow/arrow-memory/ and see what versions are available (e.g. 9.0.0.dev501).
2. Add Apache Nightlies Repository to the Maven/Gradle project.

   .. code-block:: xml

      <properties>
         <arrow.version>9.0.0.dev501</arrow.version>
      </properties>
      ...
      <repositories>
         <repository>
               <id>arrow-apache-nightlies</id>
               <url>https://nightlies.apache.org/arrow/java</url>
         </repository>
      </repositories>
      ...
      <dependencies>
         <dependency>
               <groupId>org.apache.arrow</groupId>
               <artifactId>arrow-vector</artifactId>
               <version>${arrow.version}</version>
         </dependency>
      </dependencies>
      ...

Installing Manually
-------------------

1. Decide nightly packages repository to use, for example: https://github.com/ursacomputing/crossbow/releases/tag/nightly-packaging-2022-07-30-0-github-java-jars
2. Add packages to your pom.xml, for example: flight-core (it depends on: arrow-format, arrow-vector, arrow-memory-core and arrow-memory-netty).

   .. code-block:: xml

      <properties>
         <maven.compiler.source>8</maven.compiler.source>
         <maven.compiler.target>8</maven.compiler.target>
         <arrow.version>9.0.0.dev501</arrow.version>
      </properties>

      <dependencies>
         <dependency>
               <groupId>org.apache.arrow</groupId>
               <artifactId>flight-core</artifactId>
               <version>${arrow.version}</version>
         </dependency>
      </dependencies>

3. Download the necessary pom and jar files to a temporary directory:

   .. code-block:: shell

      $ mkdir nightly-packaging-2022-07-30-0-github-java-jars
      $ cd nightly-packaging-2022-07-30-0-github-java-jars
      $ wget https://github.com/ursacomputing/crossbow/releases/download/nightly-packaging-2022-07-30-0-github-java-jars/arrow-java-root-9.0.0.dev501.pom
      $ wget https://github.com/ursacomputing/crossbow/releases/download/nightly-packaging-2022-07-30-0-github-java-jars/arrow-format-9.0.0.dev501.pom
      $ wget https://github.com/ursacomputing/crossbow/releases/download/nightly-packaging-2022-07-30-0-github-java-jars/arrow-format-9.0.0.dev501.jar
      $ wget https://github.com/ursacomputing/crossbow/releases/download/nightly-packaging-2022-07-30-0-github-java-jars/arrow-vector-9.0.0.dev501.pom
      $ wget https://github.com/ursacomputing/crossbow/releases/download/nightly-packaging-2022-07-30-0-github-java-jars/arrow-vector-9.0.0.dev501.jar
      $ wget https://github.com/ursacomputing/crossbow/releases/download/nightly-packaging-2022-07-30-0-github-java-jars/arrow-memory-9.0.0.dev501.pom
      $ wget https://github.com/ursacomputing/crossbow/releases/download/nightly-packaging-2022-07-30-0-github-java-jars/arrow-memory-core-9.0.0.dev501.pom
      $ wget https://github.com/ursacomputing/crossbow/releases/download/nightly-packaging-2022-07-30-0-github-java-jars/arrow-memory-netty-9.0.0.dev501.pom
      $ wget https://github.com/ursacomputing/crossbow/releases/download/nightly-packaging-2022-07-30-0-github-java-jars/arrow-memory-core-9.0.0.dev501.jar
      $ wget https://github.com/ursacomputing/crossbow/releases/download/nightly-packaging-2022-07-30-0-github-java-jars/arrow-memory-netty-9.0.0.dev501.jar
      $ wget https://github.com/ursacomputing/crossbow/releases/download/nightly-packaging-2022-07-30-0-github-java-jars/arrow-flight-9.0.0.dev501.pom
      $ wget https://github.com/ursacomputing/crossbow/releases/download/nightly-packaging-2022-07-30-0-github-java-jars/flight-core-9.0.0.dev501.pom
      $ wget https://github.com/ursacomputing/crossbow/releases/download/nightly-packaging-2022-07-30-0-github-java-jars/flight-core-9.0.0.dev501.jar
      $ tree
      .
      ├── arrow-flight-9.0.0.dev501.pom
      ├── arrow-format-9.0.0.dev501.jar
      ├── arrow-format-9.0.0.dev501.pom
      ├── arrow-java-root-9.0.0.dev501.pom
      ├── arrow-memory-9.0.0.dev501.pom
      ├── arrow-memory-core-9.0.0.dev501.jar
      ├── arrow-memory-core-9.0.0.dev501.pom
      ├── arrow-memory-netty-9.0.0.dev501.jar
      ├── arrow-memory-netty-9.0.0.dev501.pom
      ├── arrow-vector-9.0.0.dev501.jar
      ├── arrow-vector-9.0.0.dev501.pom
      ├── flight-core-9.0.0.dev501.jar
      └── flight-core-9.0.0.dev501.pom

4. Install the artifacts to the local Maven repository with ``mvn install:install-file``:

   .. code-block:: shell

      $ mvn install:install-file -Dfile="$(pwd)/arrow-java-root-9.0.0.dev501.pom" -DgroupId=org.apache.arrow -DartifactId=arrow-java-root -Dversion=9.0.0.dev501 -Dpackaging=pom
      $ mvn install:install-file -Dfile="$(pwd)/arrow-format-9.0.0.dev501.pom" -DgroupId=org.apache.arrow -DartifactId=arrow-format -Dversion=9.0.0.dev501 -Dpackaging=pom
      $ mvn install:install-file -Dfile="$(pwd)/arrow-format-9.0.0.dev501.jar" -DgroupId=org.apache.arrow -DartifactId=arrow-format -Dversion=9.0.0.dev501 -Dpackaging=jar
      $ mvn install:install-file -Dfile="$(pwd)/arrow-vector-9.0.0.dev501.pom" -DgroupId=org.apache.arrow -DartifactId=arrow-vector -Dversion=9.0.0.dev501 -Dpackaging=pom
      $ mvn install:install-file -Dfile="$(pwd)/arrow-vector-9.0.0.dev501.jar" -DgroupId=org.apache.arrow -DartifactId=arrow-vector -Dversion=9.0.0.dev501 -Dpackaging=jar
      $ mvn install:install-file -Dfile="$(pwd)/arrow-memory-9.0.0.dev501.pom" -DgroupId=org.apache.arrow -DartifactId=arrow-memory -Dversion=9.0.0.dev501 -Dpackaging=pom
      $ mvn install:install-file -Dfile="$(pwd)/arrow-memory-core-9.0.0.dev501.pom" -DgroupId=org.apache.arrow -DartifactId=arrow-memory-core -Dversion=9.0.0.dev501 -Dpackaging=pom
      $ mvn install:install-file -Dfile="$(pwd)/arrow-memory-netty-9.0.0.dev501.pom" -DgroupId=org.apache.arrow -DartifactId=arrow-memory-netty -Dversion=9.0.0.dev501 -Dpackaging=pom
      $ mvn install:install-file -Dfile="$(pwd)/arrow-memory-core-9.0.0.dev501.jar" -DgroupId=org.apache.arrow -DartifactId=arrow-memory-core -Dversion=9.0.0.dev501 -Dpackaging=jar
      $ mvn install:install-file -Dfile="$(pwd)/arrow-memory-netty-9.0.0.dev501.jar" -DgroupId=org.apache.arrow -DartifactId=arrow-memory-netty -Dversion=9.0.0.dev501 -Dpackaging=jar
      $ mvn install:install-file -Dfile="$(pwd)/arrow-flight-9.0.0.dev501.pom" -DgroupId=org.apache.arrow -DartifactId=arrow-flight -Dversion=9.0.0.dev501 -Dpackaging=pom
      $ mvn install:install-file -Dfile="$(pwd)/flight-core-9.0.0.dev501.pom" -DgroupId=org.apache.arrow -DartifactId=flight-core -Dversion=9.0.0.dev501 -Dpackaging=pom
      $ mvn install:install-file -Dfile="$(pwd)/flight-core-9.0.0.dev501.jar" -DgroupId=org.apache.arrow -DartifactId=flight-core -Dversion=9.0.0.dev501 -Dpackaging=jar

5. Validate that the packages were installed:

   .. code-block:: shell

      $ tree ~/.m2/repository/org/apache/arrow
      .
      ├── arrow-flight
      │   ├── 9.0.0.dev501
      │   │   └── arrow-flight-9.0.0.dev501.pom
      ├── arrow-format
      │   ├── 9.0.0.dev501
      │   │   ├── arrow-format-9.0.0.dev501.jar
      │   │   └── arrow-format-9.0.0.dev501.pom
      ├── arrow-java-root
      │   ├── 9.0.0.dev501
      │   │   └── arrow-java-root-9.0.0.dev501.pom
      ├── arrow-memory
      │   ├── 9.0.0.dev501
      │   │   └── arrow-memory-9.0.0.dev501.pom
      ├── arrow-memory-core
      │   ├── 9.0.0.dev501
      │   │   ├── arrow-memory-core-9.0.0.dev501.jar
      │   │   └── arrow-memory-core-9.0.0.dev501.pom
      ├── arrow-memory-netty
      │   ├── 9.0.0.dev501
      │   │   ├── arrow-memory-netty-9.0.0.dev501.jar
      │   │   └── arrow-memory-netty-9.0.0.dev501.pom
      ├── arrow-vector
      │   ├── 9.0.0.dev501
      │   │   ├── _remote.repositories
      │   │   ├── arrow-vector-9.0.0.dev501.jar
      │   │   └── arrow-vector-9.0.0.dev501.pom
      └── flight-core
          ├── 9.0.0.dev501
          │   ├── flight-core-9.0.0.dev501.jar
          │   └── flight-core-9.0.0.dev501.pom

6. Compile your project like usual with ``mvn clean install``.

.. _builds@arrow.apache.org: https://lists.apache.org/list.html?builds@arrow.apache.org
.. _GitHub Nightly: https://github.com/ursacomputing/crossbow/releases/tag/nightly-packaging-2022-07-30-0-github-java-jars

Installing Staging Packages
===========================

.. warning::
    These packages are not official releases. Use them at your own risk.

Arrow staging builds are created when a Release Candidate (RC) is being prepared. This allows users to test the RC in their applications before voting on the release.


Installing from Apache Staging
--------------------------------
1. Look up the next version number for the Arrow libraries used.

2. Add Apache Staging Repository to the Maven/Gradle project.

   .. code-block:: xml

      <properties>
         <arrow.version>9.0.0</arrow.version>
      </properties>
      ...
      <repositories>
         <repository>
               <id>arrow-apache-staging</id>
               <url>https://repository.apache.org/content/repositories/staging</url>
         </repository>
      </repositories>
      ...
      <dependencies>
         <dependency>
               <groupId>org.apache.arrow</groupId>
               <artifactId>arrow-vector</artifactId>
               <version>${arrow.version}</version>
         </dependency>
      </dependencies>
      ...