You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jose Rojas <jr...@redlinesolutions.co> on 2013/01/17 11:00:36 UTC

Packaging ant scripts into a jar

Hello,

I have an ant build process that I would like bundle into a jar.  Is it
possible for ant to run a build.xml found within a jar file instead of a
file within the local file system?  I know I can script Ant within a custom
Java program to possibly handle some of this, but I also have special hooks
within my custom build.xml that use the 'ant' task to call external ant
scripts for extra customization. It would be nice if Ant could look within
the current classpath/jar to find these, or if not within the
classpath/jar, then look for it within the file system.

Is this architecture possible with Ant?

Thanks for the help.

Re: AW: Packaging ant scripts into a jar

Posted by Rob Seegel <Ro...@comcast.net>.
Hmm... one way you could accomplish this would to be import the build 
file as a resource.
Take a look at the Import task docs in the Ant manual - specifically the 
section under: "any resource or resource collection." This was added in 
Ant 1.8.0.  It seems similar enough to what you're looking to do.

Rob

On 1/18/13 1:34 AM, Matèrne, Jan (RZF, SG 481) wrote:
> If I read the source of Ants main class [1] I would think, that the buildfile must be a real file on the file system. It cannot be run from the classpath.
>
> What do you expect from bundling the buildfile in a jar?
>
> A workaround is using a "launcher buildfile" which extracts the content oft he jar (maybe download the jar before from a repository) and <ant> the downloaded file.
>
>
> Viele Grüße
> Jan
>
> [1] http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools/ant/Main.java
>
>
> -----Ursprüngliche Nachricht-----
> Von: jrojas@redlinesolutions.biz [mailto:jrojas@redlinesolutions.biz] Im Auftrag von Jose Rojas
> Gesendet: Donnerstag, 17. Januar 2013 11:01
> An: Ant Users List
> Betreff: Packaging ant scripts into a jar
>
> Hello,
>
> I have an ant build process that I would like bundle into a jar.  Is it
> possible for ant to run a build.xml found within a jar file instead of a
> file within the local file system?  I know I can script Ant within a custom
> Java program to possibly handle some of this, but I also have special hooks
> within my custom build.xml that use the 'ant' task to call external ant
> scripts for extra customization. It would be nice if Ant could look within
> the current classpath/jar to find these, or if not within the
> classpath/jar, then look for it within the file system.
>
> Is this architecture possible with Ant?
>
> Thanks for the help.
>
> ---------------------------------------------------------------------
> 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


AW: Packaging ant scripts into a jar

Posted by Matèrne, "Jan (RZF, SG 481)" <ja...@fv.nrw.de>.
If I read the source of Ants main class [1] I would think, that the buildfile must be a real file on the file system. It cannot be run from the classpath.

What do you expect from bundling the buildfile in a jar?

A workaround is using a "launcher buildfile" which extracts the content oft he jar (maybe download the jar before from a repository) and <ant> the downloaded file.


Viele Grüße
Jan

[1] http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools/ant/Main.java


-----Ursprüngliche Nachricht-----
Von: jrojas@redlinesolutions.biz [mailto:jrojas@redlinesolutions.biz] Im Auftrag von Jose Rojas
Gesendet: Donnerstag, 17. Januar 2013 11:01
An: Ant Users List
Betreff: Packaging ant scripts into a jar

Hello,

I have an ant build process that I would like bundle into a jar.  Is it
possible for ant to run a build.xml found within a jar file instead of a
file within the local file system?  I know I can script Ant within a custom
Java program to possibly handle some of this, but I also have special hooks
within my custom build.xml that use the 'ant' task to call external ant
scripts for extra customization. It would be nice if Ant could look within
the current classpath/jar to find these, or if not within the
classpath/jar, then look for it within the file system.

Is this architecture possible with Ant?

Thanks for the help.

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