ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Davison <peterdavi...@tfnet.ca>
Subject Re: Linux/Windows portability
Date Mon, 10 May 2004 17:04:26 GMT
Hi Bernd.

I've always handled these kind of situations by overriding the necessary
properties in a user specific file.  For example:

I create a file in my home directory called: .ant.properties

Then I define a property file in the build.xml file:

<property file="${user.home}/.ant.properties" />

In that file - ".ant.properties" - you can override any properties you need to:
mysql.dir=/home/peter/projects/mysql/

Then use them in your build script:
<property name="mysql"
location="${mysql.dir}/mysql-connector-java-3.0.11-stable-bin.jar"/>

This way you can not only handle different operating system environments but you
can handle different user environments as well - each user doesn't have to have
the exact same directory structure.

Hope that helps,
Pete

Quoting Bernd Juergens <juergens@promedico.com>:

> Hi,
> 
> I need a build.xml for both Windows and Linux. Currently, I uses something 
> like this:
> 
> 
> <property name="mysqlwin" 
> location="c:/jarbox/mysql-connector-java-3.0.11-stable-bin.jar"/>
> <property name="mysqllin" 
> location="/usr/share/jdbc-mysql/lib/mysql-connector-java-3.0.11-stable-bin.jar"/>
> 
> <property name="mysql" location="${mysqlwin}:${mysqllin}"/>
> 
> <target name="compileHeather" description="compile heather" >
>  <javac srcdir="${src}:${generated}" destdir="${classes}" 
> includes="heather/**" classpath="${mysql}" failonerror="on"/>
> </target>
> 
> So, in ${mysql} are both Windows and Linux pathes - though only
> one would be needed.
> 
> Any better way of doing this? 
> 
> The problem is that I have a lot of dependencies on external jar files and I
> 
> want a simple way to put all those jars in a directory.
> 
> Thanks a lot,
> Bernd
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 


-- 
Peter Davison
peterdavison@tfnet.ca

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


Mime
View raw message