• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Trying to combine ant files into one run, and have java pull information from the Manifest.

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to figure out the best way to explain what I'm looking for here, so please bare with me.


I am writing code that uses an external API from a third party, so I am including several external jars in my build. There are many versions and builds of these jars i need to support. I am working with java 1.5

For example my code needs to work with

Version 5.2 builds 12 and 207

as well as

Version 6.3 builds 022 and 200


Right now I have two Eclipse projects that are specifically coded against the appropriate version, and I have ant files that compile against the appropriate builds of the external jars.

With other builds and versions coming down the road, and things already confusing I want to simplify things, so I have one ANT file to run them all. I"m assuming this won't be too hard, and can be looked up elsewhere.

My issue is that when I run the code from the created jar, I'm printing out information:

External Product: V 5.2 build 12 Product version 1.1.7
Build date: ddMMyyyy

But these are strings that I am manually changing in my code, before I run the appropriate Ant file. Is there a way I can have this information put into the created manifest file, and then have Java read from the Manifest file, so I don't have to even think about it? What I would love to do is to put "V1.1.7" into my master Ant file, and it distributes that information to the other Ant files which then create the proper manifests, which THEN the java reads and spits out the right information to the user.

I will say that I am pretty much am not very experienced with Ant. I created my Ant build about 3 months ago as my first experience with Ant, and asides from copying the file I already created I haven't touched it since.

If anybody has any ideas, or if I'm not being clear in what I'm looking for let me know.
 
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like this http://ant.apache.org/manual/CoreTasks/manifest.html may help
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me see if I understand you correctly.

Your app includes a third-party JAR file. When your app starts, it prints out the version number of that third-party JAR file. You have two different version of your app (or two different apps) which use two different versions of the third-party JAR file. You would like the Ant build script to find out as automagically as possible which version of the third-party JAR you are building with. Is that the gist of it?

If so, is there a class that appears in one of the third-party JAR versions but not the other? If so you can use the available task, something like this, with the other version being the default:



In the above example, the com.some.package.ClassName class appears only in the 5.2 version of the third-party JAR file. If that class is in the build classpath, then the version is set to 5.2. If not, the default value of 6.3 is used.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic