I would provide several jars: - application-core.jar: contains the application and the interfaces - application-activemq.jar: contains the interface implementations for ActiveMQ - application-hornetq.jar ...
The approach you'll try to achieve (as I understand that) is having a "full jar" for each impl - application-activemq.jar: all for ActiveMQ - application-hornetq.jar: all für HornetQ... Both strategies would work with pattern. Something like <jar destfile="application-core.jar" > <fileset ... excludes="**/transportX/,**/transportY/...... /> <jar destfile="application-${transport-strategy}.jar > <fileset ... includes="**/${transport-strategy}/" /> or <jar destfile="application-${transport-strategy}.jar > <fileset ... excludes="**/transportX/,**/transportY/...... /> <fileset ... includes="**/${transport-strategy}/" /> Some more ideas for improvements: - define a <macrodef> for creating the transport-jars - if you want to build only for the 'current' transport system, use <available> for setting the ${transport-strategy} Jan > -----Ursprüngliche Nachricht----- > Von: Gagnon, Joseph - 0558 - MITLL [mailto:joseph.gag...@ll.mit.edu] > Gesendet: Donnerstag, 19. März 2015 19:45 > An: user@ant.apache.org > Betreff: How do I create a customized build? > > First let me preface this question by stating that I'm very much an Ant > newbie. > > I have a Java application that was designed to provide the ability to > "plug > in" a message transport mechanism (e.g. ActiveMQ) for a given client > installation. The code defines interfaces for the transport and then > there > are a number of implementations that conform to the interfaces, > providing > concrete implementations of the transports we support. The idea is > that a > given client will indicate the transport they want/need to use and we > will > provide them with a build that includes only the classes for the chosen > implementation. No other transport implementations should be included. > The > reasons for this are to keep code size down and for 3rd party licensing > issues. > > How do you set up an Ant build file to customize the jar file produced > so that > it only includes a subset of the transport implementations? Obviously > I need > to somehow get the transport selection into the build file so that it > has the > info it needs. From what I've read, you have to use properties to get > input > arguments into the script. Beyond that, I am at a loss as to what to > do next. > > I'll provide a brief package hierarchy to illustrate what is located > where. > If it makes sense to restructure this in some way, please let me know. > > <base package>.impl > config > TransportConfig.java <- Used to unmarshal a file used to > configure the > transport > transport > impl <- Where the supported transport > implementations live > dds.rti > jms.activemq > udp > <transportX> > <other packages and classes> > <other packages and classes> > <base package>.service > TransportFactoryLoader.java <- Uses a ServiceLoader to load a > transport > factory > (currently set up in build file) > <base package>.transport <- Contains the interfaces the > transports must > implement > <transport interfaces> > > So, as an example, client A will be using ActiveMQ. We want to run the > build > so that only the <base package>.impl.transport.impl.jms.activemq > classes are > included, but nothing from the rti.dds, udp, etc. packages are > included. I've > tried to find information in this area, but have found nothing helps. > > I am open to any suggestions and ideas about how to go about this. > > Thanks, > Joe Gagnon > > Engineer II > Group 58 - Cyber Systems & Technology > MIT Lincoln Laboratory > Lexington, MA --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org