2 Replies Latest reply on Feb 3, 2011 10:21 AM by ktnagel

    Proposal: give start classes to Unused Jar Report

    ktnagel

      Hello Collegues,

       

      just recently i came accross the problem to find the minimum set of jar's an EJB Client needs from the supplied set. (as we use java web start we need to minimize download volume.) So i put the client's JAR together with all supplied jars in a directory and let tattletale report unused jars.

       

      When using the "unused jar report" it would be very helpful if the start class(es) could be named as an option.  Obviously a set of indirectly instantiated classes need also to be defined, such as classed loaded by reflection or injection. (It's a bit like giving 'includes' to the old ejbjar ant task.) That way it would be possible to detect the convex hull of the used jars of a program (or servlet, applet etc).

       

      Currently the user needs to remove unused jars again and again, in order to find and remove those jars that are only indirectly used by otherwise unused jars, until only the jar(s) containing the start class(es) are left as "unused".

       

       

      Regards from Germany,

      Thomas Nagel

        • 1. Proposal: give start classes to Unused Jar Report
          jesper.pedersen

          This would mean that each JAR should provide a list of classes that are loaded through reflection.

           

          I think a better approach is to

          1. During the scan of the archive check if the reflection api is used
          2. Scan the string constant pool for values that are class definitions

           

          Ok, that won't give us the complete picture, but we are closer and can then look at ways to improve the result.

          • 2. Proposal: give start classes to Unused Jar Report
            ktnagel

            Hmm. Maybe some classes could also called by external definitions, like servlet classes, and thus need to be named manually.

            Anyway, the set of externally called classes should be a relative small set i'd say.