ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: Renaming files in a fileset??
Date Wed, 09 Mar 2005 22:56:51 GMT

Oh, you know what.  I think I ended up having to first copy all the files to a
single directory so that I could first use the "flatten" mapper on my fileset
first (since all libs live inside a single parent base directory, but are
scattered within at different levels of depth).  Then I did the copy (and I
delted everything first to make sure that libs I removed from the fileset don't
get left there for deployment).  Here's exactly what I did...

<delete quiet="true">
    <fileset dir="${libdir}"/>
</delete>
<copy todir="${libdir}">
    <fileset refid="war.fileset"/>
    <mapper type="flatten"/>
</copy>
<copy todir="${wardir}/WEB-INF/lib">
    <fileset dir="${libdir}"/>
    <mapper type="regexp" from="^(\w+(\-*\w*)*)(\-+([0-9]?.?)*)*(.jar)$$"
to="\1\5"/>
</copy>


Jake

Quoting Jacob Kjome <hoju@visi.com>:

>
> I'm not going to guarantee that this works.  I worked on this a while back
> and
> commented it out because I went another route, but wanted to keep this around
> for reference.  The Regexp might be able to be written better as well.  Try
> it
> and see if it works for you.  Let me know if it does.
>
> <copy todir="${deploy.dest}/lib" overwrite="yes">
>     <fileset refid="compile.libs"/>
>     <fileset refid="runtime.libs"/>
>     <mapper type="regexp" from="^(\w+(\-*\w*)*)(\-+([0-9]?.?)*)*(.jar)$$"
> to="\1\5"/>
> </copy>
>
>
> Jake
>
> Quoting Casey Daniell <CDaniell@realm.com>:
>
> > Is there any good way to automatically rename files in a fileset?
> >
> > Situation, I have many different products that I support, instead of
> > including specific libraries in the build script I include a reference to
> > the files which is resolved in a properties file. This allows me to easily
> > vary different versions of a particular library, without manually changing
> > build script(s) every time. We have one product that is spread
> > across 5 CVS modules this allows one property file change to affect all CVS
> > modules.
> >
> > I would like to be able to rename the libraries from log4j-1.2.8.jar to
> > log4j.jar, when I copy the file contained in a fileset to the distro point.
> > Is there any easy way to do this? (Basically just strip out the number part
> > of the library name.)
> >
> > Casey
> >
> > Current snippets of code:
> >    <!-- These libraries are required to compile and run production code -->
> >    <fileset id="compile.libs" dir="${libs.home}">
> >       <include name="${commons-cli}"/>
> >       <include name="${commons-codec}"/>
> >       <include name="${commons-lang}"/>
> >       <include name="${commons-logging}"/>
> >    	  <include name="${log4j}"/>
> >    	  <include name="${realmutil}"/>
> >       <include name="${realm-commons}"/>
> >    	  <include name="${xbean}"/>
> >    </fileset>
> >
> >    <!-- These libraries are only required to run production code
> >         Note that they are NOT required to compile production code -->
> >    <fileset id="runtime.libs" dir="${libs.home}">
> >       <include name="${activation}"/>
> >       <include name="${jtds}"/>
> >       <include name="${log4j}"/>
> >       <include name="${mail}"/>
> >       <include name="${ojdbc14}"/>
> >       <include name="${xercesImpl}"/>
> >       <include name="${xalan}"/>
> >    </fileset>
> >
> > ...
> > ...
> > ...
> >    <target name="compile" depends="init" description="Compile Java
> sources">
> >       <javac srcdir="${src.home}"
> >              destdir="${build.classes}"
> >              debug="${compile.debug}"
> >              deprecation="${compile.deprecation}"
> >              source="${compile.source}"
> >              optimize="${compile.optimize}"
> >              classpathref="compile.classpath"/>
> >    </target>
> > ...
> > ...
> > ...
> >       <copy todir="${deploy.dest}/lib" overwrite="yes">
> >          <fileset refid="compile.libs"/>
> >          <fileset refid="runtime.libs"/>
> >       </copy>
> >
> >
> > Casey B. Daniell
> > Realm Business Solutions, Inc.
> > 13727 Noel Rd. Suite 800
> > Dallas, TX 75240
> > cdaniell@realm.com <mailto:cdaniell@realm.com>
> > O:(469) 791-1065
> > H:(972) 980-4156
> > C:(512) 589-3667
> >
> >
> > Register Now!
> > FUSION 2005 User Conference
> > June 1 - 3
> > San Diego, CA
> > For more information or to register, visit
> > www.realm.com/company/fusion.html
> <http://www.realm.com/company/fusion.html>
> >
> >
> >
> > NOTICE: This communication contains information which is confidential to
> > Realm Business Solutions, Inc. or its subsidiary ("Realm"). If you are not
> > the intended recipient of this communication, please delete and destroy all
> > copies. If you are the intended recipient of this communication, you should
> > not copy, disclose or distribute this communication without Realm's
> > authority. Any views expressed in this communication are those of the
> > individual sender, except where the sender specifically states them to be
> > Realm's views. Except as required by law, Realm does not represent, warrant
> > or guarantee that the integrity of this communication has been maintained
> > nor that the communication is free of errors, harmful code, interception or
> > interference.
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>




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


Mime
View raw message