Hi,
See the attached patch for an Ant (1.7+, uses the EchoXML task) target
that creates Eclipse .project and .classpath files that allow POI to
be easily imported in Eclipse. With this target, "ant eclipse" in POI
is roughly equivalent to "mvn eclipse:eclipse" in a Maven project.
I'm not too happy about the solution so far as it hardcodes the
resource paths otherwise referred to as properties like ${main.src}.
The reason for the hardcoding is that Eclipse wants relative paths
instead of the absolute paths used by the current POI properties.
Due to the above flaw I'm not sure if this should be included in svn
trunk, so I'm making the patch available here on the mailing list
instead of the issue tracker.
BR,
Jukka Zitting
From 25a5c8bcb5436f4b418b01ce8d0cf3b083f4ee07 Mon Sep 17 00:00:00 2001
From: Jukka Zitting <[EMAIL PROTECTED]>
Date: Mon, 14 Jul 2008 19:30:37 +0300
Subject: [PATCH] Ant target to create Eclipse project files for POI
Use the EchoXML task in Ant 1.7+ to generate the .project and .classpath
files for an Eclipse project. The resulting project can be imported in
Eclipse using File -> Import... -> Existing Projects into Workspace.
Note that this eclipse target does not use the ${main.src}, ${main.jar1.dir},
etc. properties, as they contain absolute paths to the build resources.
Eclipse requires paths to be relative to the project root.
---
build.xml | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/build.xml b/build.xml
index b934555..e3e494d 100644
--- a/build.xml
+++ b/build.xml
@@ -1207,6 +1207,56 @@ FORREST_HOME environment variable!</echo>
style="jdepend.xsl"/>
</target>
+ <target name="eclipse" depends="compile"
+ description="Generates Eclipse project files">
+ <echoxml file=".project">
+ <projectDescription>
+ <name>Apache POI</name>
+ <comment/>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+ </projectDescription>
+ </echoxml>
+ <echoxml file=".classpath">
+ <classpath>
+ <classpathentry kind="src" path="src/java"
+ output="build/classes"/>
+ <classpathentry kind="src" path="src/testcases"
+ output="build/test-classes"/>
+ <classpathentry kind="src" path="src/contrib/src"
+ output="build/contrib-classes"/>
+ <classpathentry kind="src" path="src/contrib/testcases"
+ output="build/contrib-test-classes"/>
+ <classpathentry kind="src" path="src/examples/src"
+ output="build/examples-classes"/>
+ <classpathentry kind="src" path="src/scratchpad/src"
+ output="build/scratchpad-classes"/>
+ <classpathentry kind="src" path="src/scratchpad/testcases"
+ output="build/scratchpad-test-classes"/>
+ <classpathentry kind="con" path="src/resources/main"/>
+ <classpathentry kind="con" path="src/resources/scratchpad"/>
+ <classpathentry kind="var" path="JRE_LIB"
+ rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
+ <classpathentry kind="lib" path="lib/commons-logging-1.1.jar"/>
+ <classpathentry kind="lib" path="lib/log4j-1.2.13.jar"/>
+ <classpathentry kind="lib" path="lib/junit-3.8.1.jar"/>
+ <classpathentry kind="lib"
+ path="src/contrib/lib/commons-beanutils-1.7.0.jar"/>
+ <classpathentry kind="lib"
+ path="src/contrib/lib/commons-collections-3.2.jar"/>
+ <classpathentry kind="lib"
+ path="src/contrib/lib/commons-lang-2.1.jar"/>
+ </classpath>
+ </echoxml>
+ </target>
+
</project>
<!-- Keep this comment at the end of the file
--
1.5.6
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]