{"id":1203,"date":"2010-07-20T19:46:12","date_gmt":"2010-07-20T18:46:12","guid":{"rendered":"http:\/\/www.gamlor.info\/wordpress\/?p=1203"},"modified":"2021-03-11T09:45:37","modified_gmt":"2021-03-11T08:45:37","slug":"analyzing-dependencies-java","status":"publish","type":"post","link":"https:\/\/www.gamlor.info\/wordpress\/2010\/07\/analyzing-dependencies-java\/","title":{"rendered":"Analyzing Dependencies Java"},"content":{"rendered":"<p>As software developers, we use daily some nice libraries to archive our goals. Of course, the libraries authors also use libraries to get the job done. In practice libraries have a some transitive dependencies. Just take a look a Hibernate, which is brings tons of libraries.<\/p>\n<div id=\"attachment_1204\" style=\"width: 510px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2010\/07\/dependencies.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1204\" class=\"size-full wp-image-1204\" title=\"dependencies\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2010\/07\/dependencies.png\" alt=\"Dependencies\" width=\"500\" height=\"484\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2010\/07\/dependencies.png 500w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2010\/07\/dependencies-300x290.png 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><p id=\"caption-attachment-1204\" class=\"wp-caption-text\">Dependencies<\/p><\/div>\n<p>Normally the dependencies are documented somewhere, so that you can include the right one in your project. Also tools like <a href=\"http:\/\/maven.apache.org\/\">Maven<\/a> or <a href=\"http:\/\/ant.apache.org\/ivy\/\">Ivy<\/a> help to include the right bits. But what if you have downloaded a project, which brings tons of required and optimal libraries with it and you want to find out the relations-ships?<\/p>\n<p>A small tool called <a href=\"http:\/\/code.google.com\/p\/jarjar\/\">Jar Jar Links<\/a> can help. Normally this tool is used to merge different jar-files. But it can also scan through jar-files and find out the dependencies.\u00a0 The command for this is this:<em> java \u2013jar jarjar.jar find jar &lt;list of jars&gt;.<\/em> For example I analyzed the some parts of Hibernate: <em>java \u2013jar jarjar.jar find jar\u00a0 hibernate3.jar;.\/lib\/required. <\/em>The output looks like this:<\/p>\n<p><em>C:\\temp\\hibernate\\hibernate3.jar -&gt; C:\\temp\\hibernate\\lib\\required\\slf4j-api-1.5.8.jar<br \/>\nC:\\temp\\hibernate\\hibernate3.jar -&gt; C:\\temp\\hibernate\\lib\\required\\commons-collections-3.1.jar<br \/>\nC:\\temp\\hibernate\\hibernate3.jar -&gt; C:\\temp\\hibernate\\lib\\required\\dom4j-1.6.1.jar<br \/>\nC:\\temp\\hibernate\\hibernate3.jar -&gt; C:\\temp\\hibernate\\lib\\required\\jta-1.1.jar<br \/>\nC:\\temp\\hibernate\\hibernate3.jar -&gt; C:\\temp\\hibernate\\lib\\required\\javassist-3.9.0.GA.jar<br \/>\nC:\\temp\\hibernate\\hibernate3.jar -&gt; C:\\temp\\hibernate\\lib\\required\\antlr-2.7.6.jar<br \/>\nC:\\temp\\hibernate\\hibernate3.jar -&gt; C:\\temp\\hibernate\\lib\\jpa\\hibernate-jpa-2.0-api-1.0.0.Final.jar<\/em><\/p>\n<p>You even can list all dependencies of classes to each other, by using: <em>java \u2013jar jarjar.jar find class &lt;list of jars&gt;.<\/em><\/p>\n<p>Anyway it\u2019s a small and useful tool. Of course, it only finds dependencies which are compiled into the classes. Stuff which is loaded via reflection cannot be detected.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As software developers, we use daily some nice libraries to archive our goals. Of course, the libraries authors also use libraries to get the job done. In practice libraries have&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[15],"tags":[295],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/1203"}],"collection":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/comments?post=1203"}],"version-history":[{"count":4,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/1203\/revisions"}],"predecessor-version":[{"id":3751,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/1203\/revisions\/3751"}],"wp:attachment":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/media?parent=1203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/categories?post=1203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/tags?post=1203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}