You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2011/02/07 14:05:51 UTC

DO NOT REPLY [Bug 50610] Add ant tasks for running POI against a workbook

https://issues.apache.org/bugzilla/show_bug.cgi?id=50610

--- Comment #11 from Yegor Kozlov <ye...@dinom.ru> 2011-02-07 08:05:46 EST ---
I checked out the latest sources from https://github.com/jsvede/excelant/. 

Firstly, I see two packages with duplicate contents: org.excelant.* and
org.apache.poi.ss.excelant.*. Was org.excelant.* added by mistake? 

Secondly, I tweaked build.xml and added a target to run junit tests. See the
attached diff. This configuration requires junit-4.7.jar in the lib directory.

The tests need to be converted to junit 3.8 because that's what POI uses
(changing junit versions is probably something we'd decide to do project wide).
This means no annotations. Sorry. 

 The test classes should be renamed to follow POI conventions: All tests should
start with Test* and extend TestCase. Also, POI expects tests to be silent (not
write to std-out or any log) when successful. 

Thirdly, Ant provides several ways of registering custom tasks and itt would be
good if ExcelAnt supports all of them:

 (1) explicit definition of taskdefs in build.xml (supported)

 (2) reference to a configuration file bundled in the jar

  <typedef resource="org/apache/poi/ss/excelant/antlib.xml"
                   classpath="YOUR-PATH-TO/poi-exelant.jar"/>


Where the antlib file is defined as follows:

<antlib>

  <taskdef name="excelant" classname="org.excelant.ExcelAntTask" />
  <taskdef name="test" classname="org.excelant.ExcelAntTest" />
  <taskdef name="setDouble" classname="org.excelant.ExcelAntSetDoubleCell" />
  <taskdef name="evaluate" classname="org.excelant.ExcelAntEvaluateCell" />

</antlib>


3. Similar to (2), but assigning a namespace URI:

  <typedef uri="poi:org.apache.poi.ss.excelant"
           resource="org/apache/poi/ss/excelant/antlib.xml"
                   classpath="YOUR-PATH-TO/poi-exelant.jar"/>

4.Using Ant's autodiscovery. Run Ant as

  ant -lib DIR_CONTAINING_EXCELANT_JAR targetName

 or copy the excelant jar into ANT_HOME/lib - and then in your build file,
simply declare the namespace on the project tag:

                <project xmlns:poi="antlib:org.apache.poi.ss.excelant">

 And all tasks of this library will automatically be available in the poi
namespace without any typedef.


I added support for (2)-(3), see my patch. (4) needs to be tested. 

Regards,
Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org