ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: How to override targets specified in import file
Date Mon, 21 Sep 2009 21:43:28 GMT

i would let the upper hierarchy be the arbiter e.g. 
//assume some property classes.dir which will be changed depending on os
<project name="master">
  <target name="choose-classes-dir">
    <property name="classes.dir" value="non_sparc_classes" />
    <condition property="classes.dir">
      <os name="SunOS" arch="sparc" value="sparc_classes/>
    </condition>  
  <ant antfile="subproject/property_based_subbuild.xml" name="jarit" inheritrefs="true">
    <property name="classes.dir" value="${classes.dir}"/>
  </ant>
</target><project name="subproject/property_based_subbuild.xml">
   <target name="jarit">
    <jar destfile="jar1.jar">
  <fileset refid="reqdClasses"/>
</jar>


<classfileset id="reqdClasses" dir="${classes.dir}">
  <rootfileset dir="${classes.dir}" includes="org/apache/tools/ant/Project*.class"/>
</classfileset>                    
</target>
</project>
closest i can come without going to maven

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni
et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.




> Subject: RE: How to override targets specified in import file
> Date: Mon, 21 Sep 2009 13:48:56 -0700
> From: dk068x@att.com
> To: user@ant.apache.org
> 
> > -----Original Message-----
> > From: Martin Gainty [mailto:mgainty@hotmail.com]
> > Sent: Monday, September 21, 2009 1:23 PM
> > To: Ant Users List
> > Subject: RE: How to override targets specified in import file
> > 
> > 
> > weblogic does that does that for each ear in the build e.g.
> > 
> > EAR1
> >  WAR
> >   WEB-INF
> >    lib
> >    classes
> >  APP-INF
> >    lib
> >    classes
> 
> Perhaps we're misunderstanding each other.  I know what WebLogic's
> APP-INF/lib directory is used for.  The target that assembles my EAR is
> defined in the imported "build.xml".  I might be able to change that
> common target, but I have to do it in a way that won't affect other
> sub-projects that use the same imported build script.  I was thinking I
> could make the common target execute a possibly overridden target, but
> that seems harder to do than simply have it call a target with an "if"
> attribute where the value of that is only defined in the subprojects
> that need to copy jars to APP-INF/lib.
> 
> Assuming I use that latter strategy, I'm having a little trouble getting
> it to work.  In the subproject's "build.xml", I defined a "fileset" with
> a particular "id" value, containing the files from that subproject that
> I want copied into APP-INF/lib.  In the imported target, I defined a
> target with an "if" attribute referencing that same "id" value.
> Unfortunately, when the target executes, the "if" test apparently fails,
> because it doesn't execute the conditional target.  I don't know whether
> the value of the "if" attribute can be the value of the "id" attribute
> on a fileset.
> 
> > > Subject: How to override targets specified in import file
> > > Date: Mon, 21 Sep 2009 12:58:21 -0700
> > > From: dk068x@att.com
> > > To: user@ant.apache.org
> > >
> > > I imagine by now I'm the umpteenth person to ask about something
> like
> > > this, but the search patterns to find this don't seem to be that
> > simple.
> > >
> > > I'm working on a small project inside a large EAR.  The small
> project
> > > imports the main project build file, which defines the important
> > > "create-ear" target.
> > >
> > > I have a need to modify this so the main "create-ear" target calls a
> > > "stub" target that can be overridden in sub-projects to do
> additional
> > > work in the EAR construction.  If the sub-project doesn't need to do
> > any
> > > additional work, it wouldn't define the target, so only the empty
> > stub
> > > would execute.
> > >
> > > In my case, at least my sub-project has to create an APP-INF/lib
> > > directory (if it doesn't exist), and copy certain jars from the
> > > sub-project into that created directory.
> > >
> > > I suppose I could instead make the "stub" instead do real work and
> > > assume that the sub-project has defined a "app-inf-jars" property
> > (for
> > > instance) and create the APP-INF/lib directory and copy in the paths
> > > specified in that property, and do nothing if that property isn't
> > set.
> > > I'm not sure which is more reasonable.
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > >
> > 
> > _________________________________________________________________
> > Bing brings you health info from trusted sources.
> >
> http://www.bing.com/search?q=pet+allergy&form=MHEINA&publ=WLHMTAG&crea=
> > TXT_MHEINA_Health_Health_PetAllergy_1x1
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

_________________________________________________________________
Ready for Fall shows? Use Bing to find helpful ratings and reviews on digital tv's.
http://www.bing.com/shopping/search?q=digital+tv's&form=MSHNCB&publ=WLHMTAG&crea=TEXT_MSHNCB_Vertical_Shopping_DigitalTVs_1x1
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message