0

I am able to get library list used in my java project using J Depend using simple java program as bellow,

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import jdepend.framework.*;
//import junit.framework.TestCase;

public class ConstraintTest {
    private JDepend jdepend;
    public static void main(String[] args) {
        JDepend jdepend = new JDepend();

        try{
            jdepend.addDirectory("C:/abc-workspace/example");
                jdepend.analyze();
                Collection collection=jdepend.getPackages();
                for (Iterator iterator = collection.iterator(); iterator.hasNext();) {
                JavaPackage type = (JavaPackage) iterator.next();
                System.out.println(type.getName());
            }
        }catch(IOException e){
            e.printStackTrace();
        }  
    }  
}

out put for above program i.e for "example" project.

java.util
java.io
jdepend.framework
java.lang
com.example

Now my task is to find Vendor name and the version number for above libraries. Is it possible to get these information from J Depend?.

Stephen Connolly
  • 13,872
  • 6
  • 41
  • 63
user2215139
  • 1,805
  • 2
  • 18
  • 24
  • It (j)depends (pun intended) on what the vendor has willed to provide as informations... Sometimes you may have nothing at all. If you use maven, you have the artifacts information; if not, you'll have to rely on whatever is in this jar's name and MANIFEST.MF if anything. – fge Jun 14 '13 at 07:13
  • sorry i didn't get you. Can you understand my need? I just asked whether is able to get vendor name and version of libraries used in my java project using J Depend? If yes how can I? – user2215139 Jun 14 '13 at 07:21
  • I did understand. What I say is that as this information is not standardized in any way, you'll have to resort on the good will of vendors/heuristics to get this information. – fge Jun 14 '13 at 07:22
  • ya got. I cannot do this job using J Depend. Thank you – user2215139 Jun 14 '13 at 08:00

0 Answers0