![]() So if you have two classes with the same package and name (happens more often than you might think), then you would be unable to tell which to use.Įven java just assumes that the first one it finds in the class path is the correct one and throws an exception if it turns out to be incorrect (MethodNotFoundException). The flaw in that thinking is that a java class (raw source or compiled) does not detail where to get the imported class from. In a sense this would be the easy part because all you would need to do is create a classloader for each jar in your maven repo, or directory or wherever the jars are, and then ask each one in turn if it contained the specific class. Presuming that you could get this information the next issue would be to back trace the classes to jars. ![]() So the next thought would be to use some sort of bytecode analyser ( asm for example) to pull out all the referenced classes from a compile class. However the Class class does not have a method which tells you this information. ![]() My first thought was that you could do this by using a class loader to iterate over all the class files in the jar and use reflection to analyse each one for their dependences. You'll find all your dependencies in folder. Or if you want download and copy in a folder all dependencies run the following command : Then open terminal, go into the containing folder of the pom.xml above and run this command : If you use maven (as I understood), you can simply use Maven Dependency plugin.įirst you need to write a basic pom.xml with all your jars, you can copy this example (i use hibernate as example), and substitute your jars :
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |