ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Close" <acl...@gmail.com>
Subject Re: Reading files, but not properties...
Date Thu, 08 Mar 2007 16:20:18 GMT
On 3/7/07, Andrew Close <aclose@gmail.com> wrote:
> On 3/2/07, Dominique Devienne <ddevienne@gmail.com> wrote:
> > On 3/2/07, Andrew Close <aclose@gmail.com> wrote:
> > > we currently have a file included with our projects called 'jar.list'.
> > >  this file contains a list of JAR files that the project depends upon.
> > > i.e.
> > >
> > > apache-ant-1.7.0.jar
> > > productA.jar
> > > productB.jar
> > > etc.jar
> > >
> > > i'd like to be able to convert the contents of this file into a
> > > path-like structure:
> > >
> > > <path id="my.dependencies">
> > >   <pathelement location="lib/apache-ant-1.7.0.jar"/>
> > >   <pathelement location="lib/productA.jar"/>
> > >   <pathelement location="lib/productB.jar"/>
> > >   <pathelement location="lib/etc.jar"/>
> > > </path>
> > >
> > > i've looked at FileSet/FileList and LoadFile/LoadProperties, but they
> > > don't appear to be quite what i'm looking for.  is there another task
> > > that does this?  or am i just not seeing/understanding how to do it
> > > with the core tasks?
> >
> > <path> <fileset dir="lib" includesfile="jar.list" /> </path> should
work.
> > It does assume all the jars in jar.list are under lib/, with relative
> > paths. --DD
>
> Dominique,
>
> thanks for the response.  i'll give this a try.  it looks almost too easy. :)
>
> thanks again,
> andy
>

for completeness i'll respond to my post and list my current solution...

<target name="eclipse" depends="init">
  <path id="eclipse.classpath">
    <fileset dir="${seed.lib.dir}"
includesfile="${ant.project.name}.dependencies" />
  </path>
  <pathconvert property="eclipse.entries" refid="eclipse.classpath"
targetos="windows"/>
  <ant antfile="${cns.script.root}/eclipse.xml" inheritAll="true" />
</target>

so i set up the path using the fileset as Dominique had suggested
(thank you), but to get the paths written out properly i needed to use
the pathconvert task.  i then call my eclipse.xml task based on a
script put together by Stefanie Tellex
(http://people.csail.mit.edu/stefie10/antAndEclipse.html) to create a
.classpath:

<project name="eclipse" default=".classpath">
  <target name=".classpath">

    <echoxml file=".classpath">
      <!--?xml version="1.0" encoding="UTF-8"?-->
      <classpath>
        <classpathentry kind="src" path="${src.dir}"/>
        <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="lib" path="${eclipse.entries}"/>
        <classpathentry kind="output" path="${build.dir}"/>
      </classpath>
    </echoxml>
		
    <replace file=".classpath" token="!--" value=""/>
    <replace file=".classpath" token="--" value=""/>

  </target>
</project>

this outputs a .classpath file that can then be used by an eclipse project.
hopefully this will help someone else in the future.

andy

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message