File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes build.xml: optimization. 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 "build.xml: optimization." Watch "build.xml: optimization." New topic
Author

build.xml: optimization.

Mariam A. Shamsi
Greenhorn

Joined: Dec 15, 2008
Posts: 16
Hello everybody,

I have about 8 jar files that I need to sign and rename them. My xml look like this:



Is there any way that let me sign the 8 jars at one signjar, and renaming each jar as follow:
original_name+Signed.jar, where original_name is the name of the jar before renaming, the one that is in jar attribute.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5830
    
    7

I think what you are trying to avoid is writing the same code multiple times because then it becomes a maintenance nightmare. One way to achieve this would be to define your own task using presetdef and then using it. Something like this:



Another mechanism would be to use antcall, passing parameters. Something like this:




JBoss In Action
Mariam A. Shamsi
Greenhorn

Joined: Dec 15, 2008
Posts: 16
Peter Johnson wrote:I think what you are trying to avoid is writing the same code multiple times because then it becomes a maintenance nightmare. One way to achieve this would be to define your own task using presetdef and then using it. Something like this:



Another mechanism would be to use antcall, passing parameters. Something like this:





Hello, thanks for your response. But, if I want to consider the 2nd suggestion, for signing the eight
jars that I have: do I need to antcall 8 times?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5830
    
    7

Yes, you would need 8 antcalls.

Another alternative would be to use the foreach task from antcontrib, but first you would have to find and install antcontrib (my last search for it didn't yield a download page).
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Peter Johnson wrote: you would have to find and install antcontrib (my last search for it didn't yield a download page).

The download page


[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
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5830
    
    7

Jeanne, as I pointed out in another forum post, that download page provides only the C++-related tasks, not any of the other tasks that I have come to know and love, such as the foreach task I mentioned. Fortunately, I have a copy of a prior release of antcontrib (version 1.0b3, as opposed to the latest which is 1.0b5) which contains all of the tasks, but I can no longer find where to downlaod that from.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Peter Johnson wrote:Jeanne, as I pointed out in another forum post, that download page provides only the C++-related tasks, not any of the other tasks that I have come to know and love, such as the foreach task I mentioned. Fortunately, I have a copy of a prior release of antcontrib (version 1.0b3, as opposed to the latest which is 1.0b5) which contains all of the tasks, but I can no longer find where to downlaod that from.

When I click on ant-contrib on that page (first column), it takes me to a download page with more options. Clicking 1.0b3 expands the options for the jar you mentioned. That's the one I'm using too. It may not be the latest, but it still available for download - which is what I think Mariam is looking for.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5830
    
    7

Interesting. The antcontrib home page, which I think is http://ant-contrib.sourceforge.net/ has download link with the URL http://sourceforge.net/project/showfiles.php?group_id=36177 (this is the same URL from your first post), which has a download link with URL http://sourceforge.net/project/showfiles.php?group_id=36177&package_id=28636&release_id=589175. That page has only the download for cpptasks.

What I don't understand is what link on the http://sourceforge.net/project/showfiles.php?group_id=36177&package_id=28636&release_id=589175 can I click to get to the http://sourceforge.net/project/showfiles.php?group_id=36177&package_id=28636 page you mentioned in your second post. I can see from the URLs that the only difference is the lack of the "&release_id=589175" parameter in the URL.

Finally! The light has dawned! When you are on the first download page (http://sourceforge.net/project/showfiles.php?group_id=36177), DO NOT CLICK THE DOWNLOAD LINK!!! Instead, click the ant-contrib link. I guess it must be obvious to people who are not morons like me that that if you want to download ant-contrib that you should not click on the download link.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Peter,
It's certainly not intuitive. I'm glad you see it now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: build.xml: optimization.