aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes common tasks in multiple build files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "common tasks in multiple build files" Watch "common tasks in multiple build files" New topic
Author

common tasks in multiple build files

satish bodas
Ranch Hand

Joined: Jun 19, 2008
Posts: 116
Hello ,
Have worked on couple of projects where have simply copy pasted build files for ant from other's / web .

Now there seems to be a common approach ::
compile / run Junit tests / war / jar / ear deploy

This seems to be repeated in my projects .

My question ::

Can I have a Master Build file and the other project specific build files which inherit from this .

I am thinking - if this is possible - than I would push common tasks in the project agnostic build file
The project build file will pass as a parameter the project name ( for creation of jar / war / ear etc )

Any pointers would be greatly appreciated
Thanks ,
~satish
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2510
    
  10

Can I have a Master Build file and the other project specific build files which inherit from this
Yes.
You can create a master build file, and import it in your project specific build.xml:You could also use Ant's ANT task to call targets from your Master Build file, although that task is designed to allow you to build subprojects rather than to call targets from a master.
[ September 02, 2008: Message edited by: Jan Cumps ]

OCUP UML fundamental and ITIL foundation
youtube channel
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30938
    
158

Satish,
Also take a look at macrodefs. They let you call the same logic with different parameter values.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Originally posted by Jeanne Boyarsky:
Satish,
Also take a look at macrodefs. They let you call the same logic with different parameter values.


And presetdefs, for simpler cases. Use them a lot - great way to reduce duplication.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
satish bodas
Ranch Hand

Joined: Jun 19, 2008
Posts: 116
Thanks Jan , Jeanne and Ilja for the help .
Thanks ,
~satish
 
jQuery in Action, 2nd edition
 
subject: common tasks in multiple build files