You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Bernd Juergens <ju...@promedico.com> on 2004/05/10 15:55:56 UTC

Linux/Windows portability

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


Re: Linux/Windows portability

Posted by Peter Davison <pe...@tfnet.ca>.
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 <ju...@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