apache-poi/content/devel/index.html
2026-02-16 20:14:18 +01:00

390 lines
14 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="Apache Forrest" name="Generator">
<meta name="Forrest-version" content="0.9">
<meta name="Forrest-skin-name" content="pelt">
<title>Apache POI&trade; - How To Build</title>
<link type="text/css" href="../skin/basic.css" rel="stylesheet">
<link media="screen" type="text/css" href="../skin/screen.css" rel="stylesheet">
<link media="print" type="text/css" href="../skin/print.css" rel="stylesheet">
<link type="text/css" href="../skin/profile.css" rel="stylesheet">
<script src="../skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="../skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="../skin/fontsize.js" language="javascript" type="text/javascript"></script>
<link rel="shortcut icon" href="../images/favicon.ico">
</head>
<body onload="init()">
<script type="text/javascript">ndeSetTextSize();</script>
<div id="top">
<!--+
|breadtrail
+-->
<div class="breadtrail">
<a href="https://www.apache.org">Apache Software Foundation</a> &gt; <a href="https://poi.apache.org">Apache POI</a><script src="../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
</div>
<!--+
|header
+-->
<div class="header">
<!--+
|start group logo
+-->
<div class="grouplogo">
<a href="https://www.apache.org"><img class="logoImage" alt="Apache Software Foundation" src="../images/asflogo_horizontal_color.svg" title="The Apache Software Foundation is a cornerstone of the modern Open Source software ecosystem &ndash; supporting some of the most widely used and important software solutions powering today's Internet economy."></a>
</div>
<!--+
|end group logo
+-->
<!--+
|start Project Logo
+-->
<div class="projectlogo">
<a href="https://poi.apache.org"><img class="logoImage" alt="Apache POI" src="../images/project-header.png" title="Apache POI is well-known in the Java field as a library for reading and writing Microsoft Office file formats, such as Excel, PowerPoint, Word, Visio, Publisher and Outlook. It supports both the older (OLE2) and new (OOXML - Office Open XML) formats."></a>
</div>
<!--+
|end Project Logo
+-->
<!--+
|start Search
+-->
<div class="searchbox">
<form action="https://www.google.com/search" method="get" class="roundtopsmall">
<input value="poi.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">&nbsp;
<input name="Search" value="Search" type="submit">
</form>
</div>
<!--+
|end search
+-->
<!--+
|start Tabs
+-->
<ul id="tabs">
<li>
<a class="unselected" href="../index.html">Home</a>
</li>
<li>
<a class="unselected" href="../help/index.html">Help</a>
</li>
<li>
<a class="unselected" href="../components/index.html">Component APIs</a>
</li>
<li class="current">
<a class="selected" href="../devel/index.html">Getting Involved</a>
</li>
</ul>
<!--+
|end Tabs
+-->
</div>
</div>
<div id="main">
<div id="publishedStrip">
<!--+
|start Subtabs
+-->
<div id="level2tabs"></div>
<!--+
|end Endtabs
+-->
<script type="text/javascript"><!--
document.write("Last Published: " + document.lastModified);
// --></script>
</div>
<!--+
|breadtrail
+-->
<div class="breadtrail">
&nbsp;
</div>
<!--+
|start Menu, mainarea
+-->
<!--+
|start Menu
+-->
<div id="menu">
<div onclick="SwitchMenu('menu_selected_1.1', '../skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('../skin/images/chapter_open.gif');">Getting Involved</div>
<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
<div class="menupage">
<div class="menupagetitle">How To Build</div>
</div>
<div class="menuitem">
<a href="../devel/nightly.html">Nightly Builds</a>
</div>
<div class="menuitem">
<a href="../devel/git.html">Git Repository</a>
</div>
<div class="menuitem">
<a href="../devel/guidelines.html">Contribution Guidelines</a>
</div>
<div class="menuitem">
<a href="../devel/who.html">Who We Are</a>
</div>
<div onclick="SwitchMenu('menu_1.1.6', '../skin/')" id="menu_1.1.6Title" class="menutitle">Planning Documents</div>
<div id="menu_1.1.6" class="menuitemgroup">
<div class="menuitem">
<a href="../devel/plan/index.html">Overview</a>
</div>
<div class="menuitem">
<a href="../devel/plan/vision10.html">1.0 Vision</a>
</div>
<div class="menuitem">
<a href="../devel/plan/vision20.html">2.0 Vision</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.1.7', '../skin/')" id="menu_1.1.7Title" class="menutitle">References</div>
<div id="menu_1.1.7" class="menuitemgroup">
<div class="menuitem">
<a href="../devel/references/index.html">Overview</a>
</div>
<div class="menuitem">
<a href="../devel/references/logocontest.html">Logo Submissions</a>
</div>
<div class="menuitem">
<a href="https://sc.openoffice.org/excelfileformat.pdf">XLS spec [PDF]</a>
</div>
<div class="menuitem">
<a href="https://xml.apache.org/cocoon/">Apache Cocoon</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.1.8', '../skin/')" id="menu_1.1.8Title" class="menutitle">Resolutions</div>
<div id="menu_1.1.8" class="menuitemgroup">
<div class="menuitem">
<a href="../devel/resolutions/index.html">Overview</a>
</div>
<div class="menuitem">
<a href="../devel/resolutions/res001.html">Minimal Coding Standards</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.1.9', '../skin/')" id="menu_1.1.9Title" class="menutitle">History</div>
<div id="menu_1.1.9" class="menuitemgroup">
<div class="menuitem">
<a href="../devel/history/index.html">The early years</a>
</div>
<div class="menuitem">
<a href="../devel/history/changes-3x.html">Changelog 3.x</a>
</div>
<div class="menuitem">
<a href="../devel/history/changes-pre3x.html">Changelog 0-2.x</a>
</div>
</div>
</div>
<div id="credit">
<hr>
<a href="https://www.apache.org/events/current-event.html"><img border="0" title="Apache Event" alt="Apache Event - logo" src="https://www.apache.org/events/current-event-125x125.png" style="width: 125px;height: 125px;"></a>
</div>
<div id="roundbottom">
<img style="display: none" class="corner" height="15" width="15" alt="" src="../skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
<!--+
|alternative credits
+-->
<div id="credit2">
<a href="https://donate.apache.org/"><img border="0" title="Support Apache" alt="Support Apache - logo" src="../images/support-asf.png" style="width: 125px;height: 125px;"></a><a href="https://www.apache.org/foundation/press/kit/#poweredby"><img border="0" title="powered by POI" alt="powered by POI - logo" src="../images/poweredby-poi-logo.png" style="width: 125px;height: 125px;"></a>
</div>
</div>
<!--+
|end Menu
+-->
<!--+
|start content
+-->
<div id="content">
<h1>Apache POI&trade; - How To Build</h1>
<div id="front-matter"></div>
<a name="JDK+Version"></a>
<h2 class="boxed">JDK Version</h2>
<div class="section">
<p>
POI 4.0 and later require JDK version 1.8 or later. JDK version 11 is required to compile module support.
</p>
<p>
POI 3.11 and later 3.x versions require JDK version 1.6 or later.
</p>
<p>
POI 3.5 to 3.10 required the JDK version 1.5 or later.
Versions prior to 3.5 required JDK 1.4+.
</p>
</div>
<a name="Install+Apache+Forrest"></a>
<h2 class="boxed">Install Apache Forrest</h2>
<div class="section">
<p>
The POI build system requires
<a href="https://forrest.apache.org/">Apache Forrest</a>
to build the documentation.
</p>
<p>
Specifically, the build has been tested to work with Forrest 0.9. When building with Forrest,
it is recommended to use Java 8.
</p>
<p>
Remember to set the FORREST_HOME environment variable.
</p>
</div>
<a name="Building+Targets+with+Gradle"></a>
<h2 class="boxed">Building Targets with Gradle</h2>
<div class="section">
<p>
The main Apache POI build was traditionally done with <a href="https://ant.apache.org/">Apache Ant</a>.
In 2021, we moved to using <a href="https://gradle.org/">Gradle</a>.
After <a href="git.html">checking out</a> the POI code, you will find <strong>gradlew</strong> and
<strong>gradlew.bat</strong>. These command files are used for running Gradle on Linux/Mac and Windows respectively.
Gradlew checks if you the right version of Gradle installed and will install it if you don't.
</p>
<p>
Note that our source releases no longer contain gradlew or gradlew.bat. You can install the Gradle tool
yourself and use it to build POI.
</p>
<p>
The main targets of interest to our users are:
</p>
<table class="ForrestTable" cellspacing="1" cellpadding="4">
<tr>
<th colspan="1" rowspan="1">Gradle Target</th>
<th colspan="1" rowspan="1">Description</th>
</tr>
<tr>
<td colspan="1" rowspan="1">clean</td>
<td colspan="1" rowspan="1">Erase all build work products (ie. everything in the
build directory</td>
</tr>
<tr>
<td colspan="1" rowspan="1">test</td>
<td colspan="1" rowspan="1">Run all unit tests from main, ooxml and scratchpad</td>
</tr>
<tr>
<td colspan="1" rowspan="1">jar</td>
<td colspan="1" rowspan="1">Produce jar files</td>
</tr>
<tr>
<td colspan="1" rowspan="1">jenkins</td>
<td colspan="1" rowspan="1">
Runs the tests which Jenkins, our Continuous Integration system, does. This includes the unit tests and various code quality checks.
Also, packages up the jars and build distributions.
</td>
</tr>
</table>
<p>
To run the tests from just one test class, use a command like:
</p>
<p>
./gradlew poi-ooxml:test --tests *TestXSSFBugs
</p>
<p>
gradlew poi-ooxml:test --tests *TestXSSFBugs
</p>
<p>
The example command runs tests in the poi-ooxml sub-project that match the name '*TestXSSFBugs'.
The '*' wildcard is useful to avoid typing the full Java package name.
</p>
</div>
<a name="Working+with+Eclipse"></a>
<h2 class="boxed">Working with Eclipse</h2>
<div class="section">
<p>
Apache POI no longer includes a pre-defined Eclipse project file. When importing the POI project,
your IDE should recognise that there is Gradle support and offer to do the build using that.
</p>
<p>
First make sure that Java is set up properly and that you can execute the 'javac' executable in your shell.
</p>
<p>
Next, open Eclipse and create a copy of the Git repository,
and import the project into Eclipse.
</p>
<p>
Note: when executing junit tests from within Eclipse, you might need to set the system
property "POI.testdata.path" to the actual location of the 'test-data' directory to make
the test framework find the required test-files. A simple value of 'test-data' usually works.
</p>
</div>
<a name="Working+with+IntelliJ+Idea"></a>
<h2 class="boxed">Working with IntelliJ Idea</h2>
<div class="section">
<p>
Import the Gradle project into your IDE. Execute a build to get all the dependencies and generated code
in place.
</p>
<p>
Note: when executing junit tests from within IntelliJ, you might need to set the system
property "POI.testdata.path" to the actual location of the 'test-data' directory to make
the test framework find the required test-files. A simple value of 'test-data' usually works.
</p>
</div>
<a name="Setting+environment+variables"></a>
<h2 class="boxed">Setting environment variables</h2>
<div class="section">
<p>Linux:
<a href="https://help.ubuntu.com/community/EnvironmentVariables">help.ubuntu.com</a>,
<a href="http://unix.stackexchange.com/questions/117467/how-to-permanently-set-environmental-variables">unix.stackexchange.com</a>
</p>
<p>Windows:
<a href="https://en.wikipedia.org/wiki/Environment_variable#DOS.2C_OS.2F2_and_Windows">en.wikipedia.org</a>
</p>
</div>
<p align="right">
<font size="-2">by&nbsp;Glen Stampoultzis,&nbsp;Tetsuya Kitahata,&nbsp;David Fisher</font>
</p>
</div>
<!--+
|end content
+-->
<div class="clearboth">&nbsp;</div>
</div>
<div id="footer">
<!--+
|start bottomstrip
+-->
<div class="lastmodified">
<script type="text/javascript"><!--
document.write("Last Published: " + document.lastModified);
// --></script>
</div>
<div class="copyright">
Copyright &copy;
2001-2026 <a href="https://www.apache.org/">The Apache Software Foundation</a>
<br>
Apache POI, POI, Apache, the Apache logo, and the Apache
POI project logo are trademarks of The Apache Software Foundation.
</div>
<div id="logos">
<a href="https://validator.w3.org/check/referer"><img style="height: 31px; width: 88px;" title="Valid HTML 4.01!" alt="Valid HTML 4.01!" src="../skin/images/valid-html401.png" class="logoImage"></a><a href="https://jigsaw.w3.org/css-validator/check/referer"><img style="height: 31px; width: 88px;" title="Valid CSS!" alt="Valid CSS!" src="../skin/images/vcss.png" class="logoImage"></a>
</div>
<div id="feedback">
Send feedback about the website to:
<a id="feedbackto" href="mailto:dev@poi.apache.org?subject=Feedback%C2%A0devel/index.html">dev@poi.apache.org</a>
</div>
<!--+
|end bottomstrip
+-->
</div>
</body>
</html>