Vilius Vaivada | 1 Mar 2011 11:43
Picon

Pull multiple .class files from multiple .jars into one .jar

Hi all,

I'm new to ant, so I might be missing something fairly obvious. My
problem:
* I have a lib/ directory full of .jar files
* I have 2 patternsets for some .class files that I want to put into two
new jar files.

After a bit of googling I have this:

<target name="foo">
  <foreach target="bar" param="jar">
    <path>
      <fileset dir="path" includes=" *.jar"/>
    </path>
  </foreach>
</target>

<target name="bar">
  <jar destfile="foo.jar">
    <zipfileset src="${jar}">
      <patternset refid="pattern_client"/>
      <patternset refid="pattern_ear"/>
    </zipfileset>
  </jar>
</target>

Obviously, it doesn't quite work (and is ugly already). I could try to
collect the .class files (zipfilesets) and jar them up afterwards
(how?). But most probably there's a much better way to do this in the
(Continue reading)

Scot P. Floess | 1 Mar 2011 15:28
Picon
Gravatar

Re: Pull multiple .class files from multiple .jars into one .jar


You can certainly unjar all the jars...apply your patternset for those 
class files and jar those into the new jar...

However, should you want to use this jar file by itself (meaning without 
the original jar files), you may find yourself getting 
ClassNotFoundException's...

For example, assume you have the following:

Jar 1
-----
Foo.class (inherits Bar.class)

Jar 2
-----
Alpha.class (inherits Beta.class)

New Jar
-------
Foo.class
Alpha.class

In the above scenario, the new jar is missing both Bar.class and 
Beta.class - therefore you will not be able to instantiate Foo nor 
Alpha...

Regardless, look at the jar and unjar tasks...

Hope that helps...
(Continue reading)

Scot P. Floess | 1 Mar 2011 15:30
Picon
Gravatar

Re: Pull multiple .class files from multiple .jars into one .jar

Sorry, my example is slightly wrong...

I mean:

Jar 1
-----
Foo.class (inherits Bar.class)
Bar.class

Jar 2
-----
Alpha.class (inherits Beta.class)
Beta.class

New Jar
-------
Foo.class
Alpha.class

On Tue, 1 Mar 2011, Scot P. Floess wrote:

>
> You can certainly unjar all the jars...apply your patternset for those class 
> files and jar those into the new jar...
>
> However, should you want to use this jar file by itself (meaning without the 
> original jar files), you may find yourself getting 
> ClassNotFoundException's...
>
> For example, assume you have the following:
(Continue reading)

Dave Cherkassky | 5 Mar 2011 06:21

How to combining patternset

Dear ANT community:

I have one patternset like this:
   <patternset id='yui.compression.dirs'>
     <include name="jade/content/**"/>
   </patternset>

And a second patterset like this:
   <property name='yui.compression.js.source.suffix' value='-debug.js' />
   <patternset id='yui.compression.files'>
     <include name="**/*${yui.compression.js.source.suffix}"/>
   </patternset>

And I have the following directory tree:
   jade/content/compress-me1-debug.js
   someotherdir/do-not-compress-me-debug.js

I want to combine the two patternsets to return files that match both patterns: yui.compression.dirs and yui.compression.files.

In other words, I'd like to write the following:
   <patternset id='to.compress'>
     ...
   </patternset>
That will match:
   jade/content/compress-me1-debug.js
but won't match:
   someotherdir/do-not-compress-me-debug.js

Note:  I *don't* want to write:
   <patternset id='yui.compression.dirs'>
(Continue reading)

Gilbert Rebhan | 5 Mar 2011 13:25
Picon

Re: How to combining patternset

-------- Original Message  --------
Subject: How to combining patternset
From: Dave Cherkassky <dcherk <at> djinnsoft.com>
To: user <at> ant.apache.org
Date: Sat Mar 05 2011 06:21:14 GMT+0100 (CET)

> Dear ANT community:
> 
> I have one patternset like this:
>   <patternset id='yui.compression.dirs'>
>     <include name="jade/content/**"/>
>   </patternset>
> 
> And a second patterset like this:
>   <property name='yui.compression.js.source.suffix' value='-debug.js' />
>   <patternset id='yui.compression.files'>
>     <include name="**/*${yui.compression.js.source.suffix}"/>
>   </patternset>

[...]

> Note:  I *don't* want to write:
>   <patternset id='yui.compression.dirs'>
>     <include name="jade/content/**/*${yui.compression.js.source.suffix}"/>
>   </patternset>
> I want the '...' to somehow refer to the two patternsets at the top of
> this email.
> 
> 
> Is there a way to do this?
(Continue reading)

Parag Doke | 7 Mar 2011 08:22
Picon
Gravatar

How to manage properties for identical tasks/macros run in parallel?

Hello ant users.
I am facing an issue with handling properties with calls to tasks/macros
nested within the parallel task. More of a logical/approach related issue
rather than anything with the tool itself. Here go the details:
Using ant:
Apache Ant version 1.8.1 compiled on April 30 2010
With Java:
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)

The most relevant part of the build.xml:
        <parallel>
            <mySleep seconds="4"/>
            <mySleep seconds="3"/>
            <mySleep seconds="2"/>
            <mySleep seconds="1"/>
        </parallel>

mySleep is my own macro with the following declaration:
    <macrodef name="mySleep">
        <attribute name="seconds"/>
        <sequential>
            <sleep seconds=" <at> {seconds}"/> <!-- In my actual case, this is
exec calls with the outputproperty attribute -->
            <property name="myProp" value="my value =  <at> {seconds}"/>
            <echo>Now working with ${myProp}</echo>
        </sequential>
    </macrodef>

(Continue reading)

Stefan Henß | 7 Mar 2011 13:14

Automatically extracted Ant FAQs

Hi everybody,

I'm currently doing research for my bachelor thesis on how to 
automatically extract FAQs from unstructured data.

For this I've built a system automatically performing the following:
- Load thousands of conversations from forums and mailing lists (don't 
mind the categories there, don't discriminate between sources).
- Build new categorization solely based on the conversation's texts (by 
clustering).
- Pick the best modelled categories as basis for one FAQ each.
- For each question (first entry in a thread) find the best reply from 
its answers.
- Select the most relevant and well formatted question/answer-pairs for 
each FAQ.

For the evaluation I'm interested in expert's perceptions of the 
results, e.g. if the questions are relevant, correctly answered, etc.
Also as I'll release a paper about the approach I'd be happy if you 
could rate one or two questions (stars on the details pages) so I'd have 
some statistics to present.

Here's the direct link to the Ant FAQs:
http://faqcluster.com/ant-java-build-task

(There are some other interesting FAQs as well at http://faqcluster.com/)

Thanks for your help

Stefan
(Continue reading)

ritchie | 7 Mar 2011 16:14
Favicon

Re: compare files from 2 directories

The problem was it was inserting the .md5 file in the same directory and also
the name of the file was different, now it works.

I have another problem though i have to compare 2 directories for files and
if file name matches then do a checksum or filesmatch, i could not find a
ant task which can do this. I have written a java class to do this but i
wanted to know whether this can be achieved without invoking a java or perl.

--
View this message in context: http://ant.1045680.n5.nabble.com/compare-files-from-2-directories-tp3400285p3412581.html
Sent from the Ant - Users mailing list archive at Nabble.com.
Stefan Bodewig | 8 Mar 2011 11:57
Picon
Favicon
Gravatar

Re: Automatically extracted Ant FAQs

On 2011-03-07, Stefan Henß wrote:

> I'm currently doing research for my bachelor thesis on how to
> automatically extract FAQs from unstructured data.

Interesting approach.

> For the evaluation I'm interested in expert's perceptions of the
> results, e.g. if the questions are relevant, correctly answered, etc.

For most of the questions I've seen I wouldn't have expected them to
come out as "frequent".  Some of them look misplaced (the where do I
donwload/install specific tasks questions are in the jar category for
example).

Of the answers I've checked most of them seemed to be the correct one
(if there is a correct answer at all, some questions may have more than
one correct answer, others none at all).  Many answers are by Matt or
Jan, so they are correct 8-)

Stefan
Mario Madunic | 9 Mar 2011 18:13

Unexpected behaviour creating dynamic ANT task via XSLT and executing via bat file

(Ant 1.8.2, XP SP3)

Background:
I’m using ANT to pipeline my conversion of XML (Excel) to PDF via the command line. So I chunked up the
various steps into separate project files and import into the build.xml. At one point an XSLT created a bat
file to copy required SVGs locally for use in the PDF. The bat file was executed using the <exec> task. A
requirement came up to strip the DTD declaration out all the SVGs, so instead of creating a simple bat file
to copy each SVG required it was changed to create a build file. In the build file are <copy> tasks and
<filterchain> <tokenfilter> to strip out the DTD declaration. This ANT build does not exist as part of the
main build.xml but executed within right after it has been created via XSLT. Hopefully that is clearer
than mud.

So here is the unexpected or unusual (at least to me) behaviour. When the copy SVGs ANT build is executed and I
hit ctrl C to stop the process to check the few files that have been copied over, the copy SVG build is still
running in the background even though the main build.xml has been stopped. Is this behaviour correct and
expected? I’m just curious more than anything and am not really looking for a solution. (To stop it
copying I open the task manager and terminate the java task running.)

Marijan (Mario) Madunic
Publishing Specialist
New Flyer Industries


________________________________
Please consider the environment before printing this e-mail.


CONFIDENTIALITY STATEMENT: This communication (and any and all information or material transmitted
with this communication) is confidential, may be privileged and is intended only for the use of the
intended recipient. If you are not the intended recipient, any review, retransmission, circulation,
(Continue reading)


Gmane