{"id":511,"date":"2022-06-28T15:28:44","date_gmt":"2022-06-28T05:28:44","guid":{"rendered":"https:\/\/ghiassy.net\/?p=511"},"modified":"2022-06-28T15:48:11","modified_gmt":"2022-06-28T05:48:11","slug":"adding-all-libraries-to-jar-file","status":"publish","type":"post","link":"https:\/\/ghiassy.net\/?p=511","title":{"rendered":"Adding all Libraries to Jar file"},"content":{"rendered":"<p><span style=\"color: #00ff00;\">In order to add all dependency libraries to single <strong>JAR<\/strong> file; Section below needs to be added to <span style=\"text-decoration: underline;\"><strong>build.xml<\/strong><\/span> file in the <strong>&lt;project&gt;<\/strong> tag:<\/span><\/p>\n<p><!--more--><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"xml\">\r\n<target name=\"package-for-store\" depends=\"jar\">\r\n        <property name=\"store.jar.name\" value=\"myProject\"\/>\r\n        <property name=\"store.dir\" value=\"store\"\/>\r\n        <property name=\"store.jar\" value=\"${store.dir}\/${store.jar.name}.jar\"\/>\r\n        <echo message=\"Packaging ${application.title} into a single JAR at ${store.jar}\"\/>\r\n        <delete dir=\"${store.dir}\"\/>\r\n        <mkdir dir=\"${store.dir}\"\/>\r\n        <jar destfile=\"${store.dir}\/temp_final.jar\" filesetmanifest=\"skip\">\r\n            <zipgroupfileset dir=\"dist\" includes=\"*.jar\"\/>\r\n            <zipgroupfileset dir=\"dist\/lib\" includes=\"*.jar\"\/>\r\n            <manifest>\r\n                <attribute name=\"Main-Class\" value=\"${main.class}\"\/>\r\n            <\/manifest>\r\n        <\/jar>\r\n        <zip destfile=\"${store.jar}\">\r\n            <zipfileset src=\"${store.dir}\/temp_final.jar\"\r\n                        excludes=\"META-INF\/*.SF, META-INF\/*.DSA, META-INF\/*.RSA\"\/>\r\n        <\/zip>\r\n        <delete file=\"${store.dir}\/temp_final.jar\"\/>\r\n<\/target>\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #00ff00;\">Then right click on<strong> build.xml file \u2192 Run Target \u2192 Other Targets \u2192 package-for-store<\/strong>. Then single jar file will be stored in Store directory in project&#8217;s folder.<\/span><\/p>\n<p><span style=\"color: #00ff00;\">Hope this helps \ud83d\ude42<\/span><\/p>\n<p><span style=\"color: #00ff00;\">\u2013 <span lang=\"en-US\">Saeed<\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In order to add all dependency libraries to single JAR file; Section below needs to be added to build.xml file in the &lt;project&gt; tag:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[],"class_list":["post-511","post","type-post","status-publish","format-standard","hentry","category-java","category-programming"],"_links":{"self":[{"href":"https:\/\/ghiassy.net\/index.php?rest_route=\/wp\/v2\/posts\/511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ghiassy.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ghiassy.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ghiassy.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ghiassy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=511"}],"version-history":[{"count":12,"href":"https:\/\/ghiassy.net\/index.php?rest_route=\/wp\/v2\/posts\/511\/revisions"}],"predecessor-version":[{"id":525,"href":"https:\/\/ghiassy.net\/index.php?rest_route=\/wp\/v2\/posts\/511\/revisions\/525"}],"wp:attachment":[{"href":"https:\/\/ghiassy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ghiassy.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ghiassy.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}