jokiazhang / metadata-extractor

Automatically exported from code.google.com/p/metadata-extractor
0 stars 0 forks source link

Build : Missing version information in META-INF/MANIFEST.MF file #78

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
** What steps will reproduce the problem?
This unit test will show that no version have been defined for the jar/package

  public void testMetadataExtractorVersion() throws Exception {    
    Package loadMetadataExt = com.drew.imaging.jpeg.JpegMetadataReader.class.getPackage();
    assertEquals("com.drew.imaging.jpeg", loadMetadataExt.getImplementationTitle());
    assertEquals("drewnoakes.com", loadMetadataExt.getImplementationVendor());
    assertEquals("2.6.4", loadMetadataExt.getImplementationVersion());
  }

** What is the expected output? What do you see instead?

I'd like to be able to retrieve the implementation version at runtime using 
native Java information.
We use it in our software to show current version of library loaded by the 
application server so that our user know if for some reason another version 
than the one expected has been loaded.

** Please provide any additional information below.

One nice approach I see in some software package is to provide 
1. a simple "Version" class in the main package of the library, with a simple 
static method getVersion().
2. a valid MANIFEST entry for the main package.

For example you could provide both 
1. a class com.drew.metadata.Version.class : getString() { return "2.6.4"; }
2. a valid MANIFEST entry , either for the whole jar of per package, your 
choice), here is for the whole jar : 

Implementation-Title: metadata-extractor
Implementation-Version: 2.6.4
Implementation-Vendor: drewnoakes.com

You could then test with following unit test : 

  public void testMetadataExtractorVersion() throws Exception {    
    assertEquals("2.6.4", com.drew.metadata.Version.getString());

    Package loadMetadataExt = com.drew.metadata.Versionclass.getPackage();
    assertEquals("com.drew.metadata", loadMetadataExt.getImplementationTitle());
    assertEquals("drewnoakes.com", loadMetadataExt.getImplementationVendor());
    assertEquals("2.6.4", loadMetadataExt.getImplementationVersion());
  }

Original issue reported on code.google.com by olivier....@gmail.com on 22 Apr 2013 at 4:05

GoogleCodeExporter commented 9 years ago
This issue has been migrated along with the project to GitHub:

https://github.com/drewnoakes/metadata-extractor/issues/22

Original comment by drewnoakes on 19 Nov 2014 at 7:10