Question

I have a few hundred textile files in my eclipse project and I have written an ant-build xml file for creating the output html files. This works fine normally. However, every time I add some .textile files to the project, I also have to edit the projectBuilder.xml file manually if the the output has to be generated. Is there a way in eclipse where I can generate the projectBuilder.xml file automatically? i.e. Lets say, I add a new folder with some 50 subfolders having .textile files inside them, I want eclipse to detect this and add those paths to the build file.

Following is part of the build file for illustration purpose:

<?xml version="1.0"?>
<project name="ALM" default="generate-html">
<property name="wikitext.standalone" value="jar" />
<path id="wikitext.classpath">
    <fileset dir="${wikitext.standalone}">
        <include name="org.eclipse.mylyn.wikitext.*core*.jar" />
    </fileset>
</path>
<taskdef classpathref="wikitext.classpath" resource="org/eclipse/mylyn/wikitext/core/util/anttask/tasks.properties" />
<target name="generate-html" description="Generate HTML from textile source">
  <wikitext-to-html markupLanguage="Textile">
    <fileset dir="${basedir}/..">
      <include name="Docu/*.textile" />
      <include name="Add-Ons/*.textile" />
      <include name="uC1/asv/ASD/doc/*.textile" />
Was it helpful?

Solution

I'm not sure, which of these 2 problems you have.

  • To automate the transformation process, select Project->Properties->Builder. Add an Ant builder and give it the Ant script that you already have. This leads to running your script on every change in the project (like the normal Java compiler). If you want to run the Ant script only when your textile files change, then have a look at the last tab "Build options" when configuring that builder, there you can restrict it to a "working set of relevant resources".

  • To dynamically get the list of directories, there are multiple ant tasks available and it might depend on your project layout what to use: Using fileset you could just find all textile files and then use the fileset contents for the generation: Find all directories in which a file exists, such that the file contains a search string Or if the directory structure very plain, then you can just iterate it with foreach: Ant: How do I interate over all subfolders and perform a task in ant.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top