Bug 57468

Summary: Add .gitkeep files to make it easier for git users to compile
Product: POI Reporter: virtuald <dustin>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: grossws
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.1   
Bug Depends on:    
Bug Blocks: 57904    

Description virtuald 2015-01-19 21:13:17 UTC
Git gets rid of empty directories, so compilation fails if 'lib' and 'compile-lib' aren't there. 

Patch is trivial: https://github.com/apache/poi/pull/16
Comment 1 Dominik Stadler 2015-01-19 21:18:26 UTC
These two directories should always be created by the compilation as they usually contain the downloaded 3rd party libs. In fact some of the POI developers work with Git-svn and do not see this problem, so can you please describe a bit more how you trigger this, e.g. which ant-steps from a clean checkout lead to which errors here for you?
Comment 2 virtuald 2015-01-19 21:28:44 UTC
From the trunk I checked out from github, at first I get this error message when doing 'ant compile':

BUILD FAILED
/Users/dspicuzz/src/poi/build.xml:404: Directory does not exist: /Users/dspicuzz/src/poi/lib

Ok.. not a big deal, easy enough to do. However, then I get this error after creating lib:

BUILD FAILED
/Users/dspicuzz/src/poi/build.xml:494: The following error occurred while executing this line:
/Users/dspicuzz/src/poi/build.xml:398: java.io.FileNotFoundException: /Users/dspicuzz/src/poi/compile-lib/bcprov-ext-jdk15on-1.51.jar (No such file or directory)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
	at org.apache.tools.ant.taskdefs.Get$GetThread.downloadFile(Get.java:796)
	at org.apache.tools.ant.taskdefs.Get$GetThread.get(Get.java:633)
	at org.apache.tools.ant.taskdefs.Get$GetThread.run(Get.java:616)


An alternative to my patch could be to check for the existance of compile-lib, and give a similar error message.
Comment 3 Dominik Stadler 2015-01-20 08:05:55 UTC
This is really strange, target "compile" depends on target "init", which depends on "check-jars" and "fetch-jars" where these directories are created. It seems somehow the check for existence of files incorrectly misses to see that the files are not there.

Can you provide the full output from running "ant -v compile" to let us see which other targets are called and why the mkdirs/downloads are not performed. I suspect this is something specific to Mac OS X here.
Comment 4 virtuald 2015-01-20 18:44:38 UTC
$ ant -v compile
Apache Ant(TM) version 1.9.4 compiled on April 29 2014
Trying the default build file: build.xml
Buildfile: /Users/dspicuzz/src/poi2/build.xml
Detected Java version: 1.8 in: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre
Detected OS: Mac OS X
parsing buildfile /Users/dspicuzz/src/poi2/build.xml with URI = file:/Users/dspicuzz/src/poi2/build.xml
Project base dir set to: /Users/dspicuzz/src/poi2
parsing buildfile jar:file:/usr/local/Cellar/ant/1.9.4/libexec/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/local/Cellar/ant/1.9.4/libexec/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
 [property] Loading Environment env.
Property "env.FORREST_HOME" has not been set
Property "env.http_proxy" has not been set
Property "env.CLASSPATH" has not been set
 [macrodef] creating macro  ooxml-test-runner
 [macrodef] creating macro  m2-install
Build sequence for target(s) `compile' is [check-jars, fetch-jars, check-ooxml-jars, fetch-ooxml-jars, init, compile-main, compile-scratchpad, check-ooxml-xsds, fetch-ooxml-xsds, check-compiled-ooxml-xsds, compile-ooxml-xsds, compile-ooxml, compile-examples, compile-excelant, compile]
Complete build sequence is [check-jars, fetch-jars, check-ooxml-jars, fetch-ooxml-jars, init, compile-main, compile-scratchpad, check-ooxml-xsds, fetch-ooxml-xsds, check-compiled-ooxml-xsds, compile-ooxml-xsds, compile-ooxml, compile-examples, compile-excelant, compile, maven.ant.tasks-check, compile-ooxml-lite, compile-all, compile-version, -manifest, jar, maven-poms, mvn-install, jar-src, jacocotask, test-ooxml-lite, release-notes, -test-excelant-write-testfile, -check-forrest-installed, -check-docs, docs, javadocs, site, rat-check, clean, -test-main-check, test-main, -test-scratchpad-check, test-scratchpad-download-resources, test-scratchpad, -test-ooxml-check, test-ooxml, -test-excelant-check, test-excelant, test, testcoveragereport, test-all, -do-jar-check-javadocs-package-list, -do-jar-create-javadocs-package-list, jar-javadocs, assemble, dist, -test-scratchpad-write-testfile, testexist, -test-main-write-testfile, compile-integration, -test-integration-check, test-integration, findbugs, help, -test-ooxml-write-testfile, downloadfile, -test-property-check, -do-jar-javadocs, jenkins, -test-integration-write-testfile, gump, ]

check-jars:

BUILD FAILED
/Users/dspicuzz/src/poi2/build.xml:404: Directory does not exist: /Users/dspicuzz/src/poi2/lib
	at org.apache.tools.ant.taskdefs.Delete.handle(Delete.java:719)
	at org.apache.tools.ant.taskdefs.Delete.execute(Delete.java:629)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.Target.performTasks(Target.java:456)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
	at org.apache.tools.ant.Main.runBuild(Main.java:851)
	at org.apache.tools.ant.Main.startAnt(Main.java:235)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Comment 5 Dominik Stadler 2015-01-21 20:47:35 UTC
Now the problem is obvious, if the lib-dir is missing, the <delete> fails. I have added an additional mkdir in r1653643 to avoid this problem. Thanks for reporting.
Comment 6 Dominik Stadler 2015-01-27 15:31:14 UTC
*** Bug 57502 has been marked as a duplicate of this bug. ***