Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#4 A more ant-ish ant task

closed
None
5
2005-03-09
2005-03-01
Lars G. Svensson
No

First off: This plugin is great and has already saved
my day several times! Kudos to all!!

I had, however, a hard time getting acquainted with the
ant task: It was a bit unintuitive and simply didn't
feel ant-ish. Specifically, I couldn't work with
relative paths or file sets. So I wrote my own one on
top of yours (which saved me from having to write any
actual functionality), in which the classes and jars to
include are specified using file sets instead.
You don't have to like it, but perhaps others do.
I realize that I probably hide some nice bits from your
task (like specifying an own manifest file), but that
could easily be added.

Looking forward to your comments

Lars

Discussion

  • Ant task source file

     
    Attachments
  • Manifest handler source file

     
    Attachments
  • Ferenc Hechler
    Ferenc Hechler
    2005-03-01

    Logged In: YES
    user_id=876063

    Hello Lars,

    thank you very much for your work,
    I am not very experienced with ant,
    so my self-designed ant-task
    became - what you call - "un-ant-ish". ;)

    Could you please provide a little example
    of how to use your ANT-Task?

    If you are interested in adding functionality
    into Fat-Jar feel free to contact me via e-mail.
    There are lot of things to do and my spare
    time is rare.....
    Perhaps you could improve the FJ-Ant-Tasks
    and the export functionality.

    Best regards,

    feri

     
  • Logged In: YES
    user_id=1030003

    Hello feri (Feri?)

    > Could you please provide a little example
    > of how to use your ANT-Task?
    Sure. (That's one of the parts I forgot...)

    You need a taskdef:

    <taskdef name="onejar"
    classname="de.ddb.ant.onejar.OnejarAntTask"
    classpath="${ant.library.dir}/ant-onejar.jar"/>

    Then the actual task

    <!-- call the task and set the name of the destination file -->
    <onejar destfile="bigandfat.jar">
    <!--
    create a manifest specifying the main class
    -->
    <manifest
    mainclass="my.own.MainClass"/>

    <!--
    now specify which classes and jars go into the
    fat jar.
    We begin with the classes. The element can be
    repeated
    -->
    <classes dir="${classes}">
    <include
    name="some.package.with.classes.to.include.**/*.*"/>
    <exclude name="one.file.or.Another"/>
    </classes>
    <!-- now specify the jars to include -->
    <jars dir="${lib}">
    <include name="foo.jar"/>
    <include name="bar.jar"/>
    <include name="this.jar"/>
    <include name="that.jar"/>
    </jars>
    </onejar>

    When I come to it, I'll write up some ant-ish documentation,
    but that might not be until next week

    > Perhaps you could improve the FJ-Ant-Tasks
    > and the export functionality.
    No problem (apart from time, of course). I'll try to dig
    deeper into the ant stuff. What is "export functionality"?

    Lars

     
  • Ferenc Hechler
    Ferenc Hechler
    2005-03-09

    • assigned_to: nobody --> larssvensson
    • status: open --> closed