You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Tommy Nordgren <to...@chello.se> on 2006/01/25 04:39:27 UTC

Making custom tasks globally available

Quoting the following example from "Extreme Programming with Ant"
<?xml version="1.0" ?>

<!DOCTYPE project [<!ENTITY sales SYSTEM
					"file:sales.xml>
					<!ENTITY common SYSTEM
					"file:common.xml">]>

<project name="eMarket" default="compile" basedir=".">

.....

	&common;
	&sales;

</project>

Where can I put files for entities, so that they are available to ALL  
my projects?

-------------------------------------
This sig is dedicated to the advancement of Nuclear Power
Tommy Nordgren
tommy.nordgren@chello.se




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


Re: Making custom tasks globally available

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 25 Jan 2006, Tommy Nordgren <to...@chello.se> wrote:

> Quoting the following example from "Extreme Programming with Ant"

Unfortunately that advice is not that good anymore.  If you are using
Ant 1.6.0 or later, use <import> instead of entity includes.

> Where can I put files for entities, so that they are available to
> ALL my projects?

In general, anywhere where it pleases you, you can use relative and
absolute paths to locate them, but this is probably far easier with
<import> (in particular since you can use Ant properties to define the
path).

Use something like

<project name="eMarket" default="compile" basedir=".">

    <property file="${user.home}/.ant/sales.properties"/>
    <import file="${import.base}/sales.xml"/>
    <import file="${import.base}/common.xml"/>
</project>

and have you developers create a sales.properties in their home
directory.  In that file they can set define the path to their copy of
the common import files.

Stefan

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


Re: Making custom tasks globally available

Posted by Tommy Nordgren <to...@chello.se>.
On Jan 25, 2006, at 4:39 AM, Tommy Nordgren wrote:

> Quoting the following example from "Extreme Programming with Ant"
> <?xml version="1.0" ?>
>
> <!DOCTYPE project [<!ENTITY sales SYSTEM
> 					"file:sales.xml>
> 					<!ENTITY common SYSTEM
> 					"file:common.xml">]>
>
> <project name="eMarket" default="compile" basedir=".">
>
> .....
>
> 	&common;
> 	&sales;
>
> </project>
>
> Where can I put files for entities, so that they are available to  
> ALL my projects?
>

	Both Stefan Bodewig have suggested useing the new <import> tag.
	However Checking a Java native Interface OSS project that uses
third party ant tasks, I've found that there is also another solution.
Using <taskdef resource="Tommys_Ant_Tasks.tasks" />
This will load a set of task defs from a property file included in my  
distribution jar.
-------------------------------------
This sig is dedicated to the advancement of Nuclear Power
Tommy Nordgren
tommy.nordgren@chello.se




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


Re: Making custom tasks globally available

Posted by Steve Loughran <st...@apache.org>.
Tommy Nordgren wrote:
> Quoting the following example from "Extreme Programming with Ant"
> <?xml version="1.0" ?>
> 
> <!DOCTYPE project [<!ENTITY sales SYSTEM
>                     "file:sales.xml>
>                     <!ENTITY common SYSTEM
>                     "file:common.xml">]>
> 
> <project name="eMarket" default="compile" basedir=".">
> 
> .....
> 
>     &common;
>     &sales;
> 
> </project>
> 
> Where can I put files for entities, so that they are available to ALL my 
> projects?
> 

I would use <import> on Ant1.6+, rather than XML includes. Then use 
properties to define locations

   <property name="root.dir" location="../.."/>
   <import file="${root.dir}/common.xml"/>

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