Menu

Combined JAR manifest issue

2008-12-16
2012-12-17
  • John C. Turnbull

    I have a project that combines several JARs into one.  To avoid warnings I filter the META-INF/MANIFEST.MF from all of the JARs except the one that contains the main class.  However, the manifest in the resulting JAR then specifies a class path that includes all of the original JARs.  It looks like it's just the same manifest from the JAR containing the main class.  Is there a way for a more accurate manifest to be created for the combined JAR which specifies a class path of just the final JAR?

    Thanks,

    John

     
    • Gili Tzabari

      Gili Tzabari - 2008-12-16

      One approach is to strip out the MANIFEST.MF file altogether and add a new hand-written one after Proguard is done. Unfortunately, Proguard has very little in the way of handling MANIFEST.MF.

       
    • John C. Turnbull

      Thanks very much cowwoc, but how would I add the hand-written manifest to the created JAR?

      John

       
      • Gili Tzabari

        Gili Tzabari - 2008-12-16

        I believe "jar -u" will do it. The <jar> ant task also supports updating existing JAR files.

        Gili

         
        • Eric Lafortune

          Eric Lafortune - 2008-12-16

          Alternatively, you can prepare a manifest file in advance, put it in a jar, and just specify it as input to ProGuard:

          -injars manifest.jar
          -injars program1.jar(!META-INF/**)
          ...
          -outjar result.jar

          Eric.

           
    • John C. Turnbull

      OK great - thanks again.

      John

       
MongoDB Logo MongoDB