ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <qazw...@gmail.com>
Subject Re: Declare few projects on a build.xml
Date Fri, 06 Mar 2009 17:31:16 GMT
One of the things you can look at is the use of property files to set
most of the variables in your various deployment environments.

You can then use the

<property file="${prop.file}"/>

in your Ant script to read in these properties, and then handle the
script based upon those properties.

Another feature of Ant is the ability to filter through files to
replace strings with other strings. For example, let's assume you
have:

@SERVER@

as a string embedded into your configuration files. Something like this:

<server name="@SERVER@"/>

You can have Ant replace the string @SERVER@ with the actual server
name while doing a copy:

Here's an example from my build.xml

        <!-- Copy the configurable files and replace any tokens -->
        <copy todir="${local.jboss.home}/server/${jboss.instance}"
            overwrite="true"
            verbose="${copy.verbose.flag}">
            <fileset dir="${jboss.install.home}/jbdev1">
                <include name="**/*.template"/>
            </fileset>
            <mapper type="glob"
                from="*.template" to="*"/>
            <filterset begintoken="@" endtoken="@">
                <filter token="path_to_server_dir"
                    value="${local.jboss.home}/server/${jboss.instance}"/>
                <filtersfile file="${deploy.properties.file}"/>
            </filterset>
        </copy>

Will this help simplify matters a bit?

Ant is usually used for building Java applications, and not as a
deployment tool. If you are mainly deploying already built warfiles,
you might be better off with another tool.

On Fri, Mar 6, 2009 at 3:04 AM, Miguel Alejandro Caro Ruger
<miguelacaro@gmail.com> wrote:
> Thanks to all for the information, but i haven´t seen anything helpful
> refered to what i want to do in the links. Maybe I haven´t explain myself
> very well, i give you my context.
>
> I have all my apllications or most of them in .war filetype and running on
> tomcat. Develop Department, give me the applications in .war compiled. So I
> just have to deploy/undeploy it into the tomcat.
> To do it more easy, safe, and centraliced i have a shellscript to do the
> application deploys for all my applications, I just pass to the script the
> name of the application and the enviroment and it deploys into the correct
> tomcat, with scp transfer to the tomcat webapps directory, with autodeploy
> enable , it works fine excepts 2 applications that some times produce an
> deploy error fixed with the ant deploy.
> My real question is:
>
> *Are there any posibility to have in the same build.xml file more than 1
> <project> label, with more than 1 application or enviroment? *
>
> It would simply my work to migrate to ant.
>
> Thanks.
>
>
> 2009/3/5 Joe Schmetzer <joe@exubero.com>
>
>> Similarly, I've also just released some Ant library scripts here:
>>
>> http://www.exubero.com/asl/
>>
>> These are just build plugins which you can either import directly in your
>> own build, or just look over them as an example of how to write re-usable
>> Ant modules.
>>
>> Cheers,
>> Joe
>>
>> On Thu, March 5, 2009 3:44 pm, Brian Pontarelli wrote:
>> > The way to accomplish this with Ant is to use <import> statements to
>> > include common build files or use the -f flag to specify a common
>> > build file for all the projects. However, if these solutions don't
>> > meet your needs you can also take a look at other solutions like these:
>> >
>> >    - Gradle
>> >    - Maven
>> >    - Savant 1.5
>> >
>> > All of these tools allow you to write common build scripts (sometimes
>> > called plugins) and reuse them across projects.
>> >
>> > -bp
>> >
>> >
>> > On Mar 5, 2009, at 5:50 AM, A A wrote:
>> >
>> >> Hello, to all the users from the list, it´s my first mail, and sorry
>> >> for my poor english.
>> >> Im starting to test ant, and building a script to automatized the
>> >> deploys of my aplications, cause before i used to manual wget
>> >> commands or autodeploys.
>> >>
>> >> The problem is I have a more than 30 aplications and 3 diferentes
>> >> enviroments for each aplications, so it woulb be like create 90
>> >> build.xml with the projects information.
>> >>
>> >> Are there any posibility to simplifiy the project and build.xml
>> >> properties declare?. It posible to create more than 1 project in a
>> >> build.xml? Or all projects in the same build.xml
>> >>
>> >> Thanks to all.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>



-- 
--
David Weintraub
qazwart@gmail.com

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


Mime
View raw message