Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Copy jars mensioned in classpath

Copy jars mensioned in classpath

2003-03-25       - By "Schaible, J?rg"
Reply:     1     2     3     4     5  

Hi Dominique,

> From: Dominique Devienne
>
> It's a little bit convoluted, but the <script> below works...
> Can <copy> or <delete> a Path reference. --DD
[snip]

although I really appreciate your work, I did not like the usage of
the script task, since I am using ant from within Eclipse and I did
not want to force anyone in our team to install all the necessary
additional jars running scripts in ant.

Lately I detected in your code the pathconvert task. While I knew,
that it exists, I did not know how flexible it was. So I came up with
a copy task using pathconvert doing its job to:

  <target name="copy-jars">
    <pathconvert property="classpath.jars" refid="classpath" pathsep=",">
      <map from="${basedir}${file.separator}" to="" />
    </pathconvert>
    <copy todir="${dist.lib}" flatten="true">
      <fileset dir="${src.dir}" includes="${classpath.jars}" />
    </copy>
  </target>

Thanks anyway,
Regards,
J?rg

> > -----Original Message-----
> > From: "Schaible, J?rg"
> > Sent: Monday, March 24, 2003 5:40 AM
> > To: Ant Users List
> > Subject: [newbie] Copy jars mensioned in classpath
> >
> > Hi,
> >
> > my application is based on several other Java libraries.
> > These are defined
> > in an
> >  external property file, e.g.
> >
> > foo.jar.foo1=${foo.dir}/foo1.jar
> > foo.jar.foo2=${foo.dir}/foo2.jar
> > foo.path=${foo.jar.foo1}:${foo.jar.foo2}
> >
> > bar.jar.bar=${bar.dir}/bar.jar
> > bar.path=${bar.jar.bar}
> >
> > you got the pattern ...
> >
> > In the build.xml I am now able to use this definitions like:
> >
> >
> >   <path id="classpath">
> >     <pathelement path="${foo.path}" />
> >     <pathelement path="${bar.path}" />
> >   </path>
> >
> >   <target name="compile">
> >     <mkdir dir="${build.dir}" />
> >     <javac srcdir="${src.java}"
> >           destdir="${build.dir}"
> >         classpathref="classpath" >
> >     </javac>
> >   </target>
> >
> >
> > Works fine.
> >
> > Now I want to copy the jars used in the classpath to a distribution
> > directory,
> > but I did not find a solution using the copy-task to define a
> > fileset based
> > on
> > the definitions made above, since every definition could
> > contain more than
> > one
> > jar file separated by a colon. Is there any task or a fileset
> > construct,
> > that
> > enables me to get the jars from the involved classpath in a fileset?
> > Regards,
> > J?rg
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.