Bug 63308

Summary: Unable to build POI 4.0.1; ooxml-schemas and ooxml-security not found
Product: POI Reporter: David Gauntt <dmgauntt>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P2    
Version: 4.0.x-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description David Gauntt 2019-04-01 11:53:52 UTC
I have checked out the SVN tag REL_4_0_1, and have been unable to build it.  This is my first time trying to build the POI project.

The issue is that ooxml-schemas-1.4.jar and ooxml-security-1.1.jar are required libraries in the build path (I am using Eclipse), but neither is present.

I have run the following ANT targets in build.xml, but to no avail:
* fetch-jars
* fetch-ooxml-xsds
* mvn-install
* maven-poms
* test-ooxml

The only hint to the problem is that when I run mvn-install I get the following error message:

C:\Users\David M. Gauntt\eclipse-workspaces\General\ApachePOI\build.xml:2178: Maven ant tasks not found.
      Please make sure the maven-ant-tasks jar is in ANT_HOME/lib, or made
      available to Ant using other mechanisms like -lib or CLASSPATH.

      You can download the Maven Ant Tasks from https://maven.apache.org/ant-tasks/download.html

I have downloaded maven-ant-tasks-2.1.3.jar, and placed it in the directory ".../External Libraries/Apache/ant/lib", and set up a Window environment variable ANT_HOME and an Eclipse variable ANT_HOME pointing to the "ant" folder, but I still get this error message.

What am I missing?
Comment 1 Dominik Stadler 2019-04-01 12:48:55 UTC
Can you try the steps described at http://poi.apache.org/devel/index.html which use Ant which is currently the main buildsystem.
Comment 2 Dominik Stadler 2019-04-03 21:35:18 UTC
I expect the steps in the documentation to work, please reopen this or discuss on the mailing list if you are still not able to build with these instructions so we can adjust/enhance them if necesary.
Comment 3 David Gauntt 2019-04-04 12:44:05 UTC
I have followed the steps described in http://poi.apache.org/devel/index.html, but it still doesn't work.  Note that the steps do not actually list which ant targets to run in which order.

The challenging step was "Remember to set the ANT_HOME environment variable and add ANT_HOME/bin to your shell's PATH."  It took a while to figure out what value the ANT_HOME environment variable should have, so I wrote up a brief description that could be added to "How to Build":

"To determine the correct value for ANT_HOME, search your file system for "ant.jar".  This file will be in the directory %ANT_HOME%/lib."  For example, if the path to ant.jar is "C:/Programs/Ant/lib/ant.jar", then set ANT_HOME to "C:/Progams/Ant"."

I will bring this to the mailing list for help, but will describe here the steps that I have taken for the record.

Once I determined where ANT_HOME is, I set the ANT_HOME environment variable in Windows, added %ANT_HOME% to the path, and then typed the following into a command prompt to verify that i had done this correctly:

dir "%ANT_HOME/lib"
set path

To make sure that I am working from a clean project, I checked out the trunk branch of POI, and ran the Ant target "compile" of build.xml.  The build failed due to 10 missing libraries (mockito-core-2.23.4.jar, objenesis-2.6.jar, xmlunit-core-2.5.1.jar, curvesapi-1.06.jar, ooxml-schemas-1.4.jar, ooxml-security-1.1.jar, xmlbeans-3.1.0.jar, guava.jar, javaassist.jar, reflections.jar).

I ran fetch-jars, and it suceeded without installing the libraries listed above.

I then ran "fetch-ooxml-xsds", which downloaded more files but which did not download the libraries listed above.

Finally I ran mvn_install, which failed with the followoing error message:

BUILD FAILED
C:\Users\David M. Gauntt\eclipse-workspaces\General\ApachePOI\build.xml:2149: Maven ant tasks not found.
      Please make sure the maven-ant-tasks jar is in ANT_HOME/lib, or made
      available to Ant using other mechanisms like -lib or CLASSPATH.

      You can download the Maven Ant Tasks from https://maven.apache.org/ant-tasks/download.html

This error message is posted by the target "maven.ant.tasks-check", which appears to be looking for something named "org.apache.maven.artifact.ant.Pom".

I then added ANT_HOME/lib/maven-ant-task-2.1.3.jar as a library to my Eclipse build path, ran mvn-install again, with the same result.
Comment 4 Dominik Stadler 2019-04-06 09:52:38 UTC
Thanks for the feedback, I will update the docs slightly about ANT_HOME.

I could not reproduce missing jar-files, a clean checkout correctly fetched all jars for me when running "compile".

The "mvn-install" target is currently mostly used for packaging new releases, so it might require a bit more setup currently, we'll take a look if it can be enhanced to run correctly from a source-only checkout.
Comment 5 David Gauntt 2019-04-08 02:53:49 UTC
I realized that there is one way that I deviated from the instructions on building the project.  The "How to build" page states

"In order to get started, first build Apache POI using Ant as described above to get all required 3rd party libraries downloaded.

Then import the project in Eclipse via File->Import->Existing Projects into Workspace."

However, I checked out the trunk branch in Eclipse, which creates the project, then ran the targets in build.xml from within the Eclipse project.  I will see if I can run Ant from the commend line to create a project, and then import the project.
Comment 6 David Gauntt 2019-04-08 03:26:53 UTC
I tried building both trunk and tag REL_4_0_0_FINAL using Ant from the command line, and got the same result - ooxml-schemas and ooxml-security were not downloaded.

I am taking this to the mailing list now.