{"id":199,"date":"2012-05-18T12:47:45","date_gmt":"2012-05-18T02:47:45","guid":{"rendered":"http:\/\/www.docx4java.org\/blog\/?p=199"},"modified":"2015-06-16T14:21:28","modified_gmt":"2015-06-16T04:21:28","slug":"docx4j-from-github-in-eclipse","status":"publish","type":"post","link":"https:\/\/www.docx4java.org\/blog\/2012\/05\/docx4j-from-github-in-eclipse\/","title":{"rendered":"docx4j from GitHub in Eclipse"},"content":{"rendered":"<p><strong>This post is old. \u00a0Please see instead <a href=\"http:\/\/www.docx4java.org\/blog\/2015\/06\/docx4j-from-github-in-eclipse-5-years-on\/\">2015\/06\/docx4j-from-github-in-eclipse-5-years-on\/<\/a><\/strong><\/p>\n<p>docx4j is now on GitHub! \u00a0<a href=\"https:\/\/github.com\/plutext\/docx4j\">https:\/\/github.com\/plutext\/docx4j<\/a><\/p>\n<p>This should make it easier for users to maintain their own branches (public or private), and contribute improvements back.<\/p>\n<p>As of now, GitHub is the project&#8217;s authoritative version control. \u00a0We&#8217;re <strong>no longer updating<\/strong> the existing <strong>svn <\/strong>repository.<\/p>\n<p>Its pretty easy to work with docx4j sources in Eclipse. This post shows you how.<\/p>\n<p>First, make sure you have eGit installed in Eclipse. \u00a0Install it from <a href=\"http:\/\/www.eclipse.org\/egit\/download\/\">here<\/a>. \u00a0On Windows, it is also useful to have <a href=\"http:\/\/code.google.com\/p\/msysgit\/downloads\/list\">msysgit<\/a>. \u00a0Refer elsewhere for how to set these up. <strong>Update:<\/strong> there is a <a href=\"http:\/\/windows.github.com\/\">GitHub Windows client<\/a> now (I haven&#8217;t tried it) which apparently includes msysgit.<\/p>\n<p>You also need <a href=\"http:\/\/eclipse.org\/m2e\/download\/\">m2eclipse<\/a><\/p>\n<p>Assuming you&#8217;ve done all that, setting up the docx4j source code is just a few steps.<\/p>\n<p>But first, be aware there is a difference between cloning and forking. \u00a0<strong>Cloning <\/strong>gives you a copy of the source code you can work on, but without more, no easy way to contribute changes back. \u00a0<strong>Forking <\/strong>sets you up with the source code, and makes it easy to contribute changes back.<\/p>\n<p>If you think you might be making changes to the docx4j source code, you&#8217;re probably best to create a fork on GitHub right from the start.<\/p>\n<p><strong>Step 1 (optional, but recommended):<\/strong> To create a fork, log in to GitHub, visit <a href=\"https:\/\/github.com\/plutext\/docx4j\">https:\/\/github.com\/plutext\/docx4j<\/a> then press the &#8220;Fork&#8221; button.<\/p>\n<p><strong>Step 2: Create your local repository<\/strong> (git <strong><span style=\"text-decoration: underline;\">clone<\/span><\/strong>)<\/p>\n<p>This can be done from within Eclipse, or using Git Gui (easiest), or Git Bash Shell.<\/p>\n<p>To do it from within Eclipse, File &gt; Import .. &gt; Repositories from GitHub:<\/p>\n<p><a href=\"http:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/1import_from_github.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-207\" title=\"1import_from_github\" src=\"http:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/1import_from_github.png\" alt=\"\" width=\"529\" height=\"557\" srcset=\"https:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/1import_from_github.png 529w, https:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/1import_from_github-284x300.png 284w\" sizes=\"auto, (max-width: 529px) 100vw, 529px\" \/><\/a><\/p>\n<p>If you forked docx4j, find your fork (it might not appear immediately, which is why Git Gui or Git Bash Shell are better for this step), select it, and click next.<\/p>\n<p>If you didn&#8217;t fork docx4j, type &#8216;docx4j&#8217; then press &#8216;search&#8217;, the <strong>plutext\/docxj<\/strong> repository should come up:<\/p>\n<p><a href=\"http:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/2import_from_github.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-208\" title=\"2import_from_github\" src=\"http:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/2import_from_github.png\" alt=\"\" width=\"547\" height=\"354\" srcset=\"https:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/2import_from_github.png 547w, https:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/2import_from_github-300x194.png 300w\" sizes=\"auto, (max-width: 547px) 100vw, 547px\" \/><\/a><\/p>\n<p>Select plutext\/docx4j, then click next.<\/p>\n<p>This creates a local git repository on your computer.<\/p>\n<p><strong>Step 3:<\/strong> Now you need to import that repository into Eclipse as a project:<\/p>\n<p>File &gt; Import .. &gt; Projects from Git<\/p>\n<p><a href=\"http:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/3import_from_git.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-209\" title=\"3import_from_git\" src=\"http:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/3import_from_git.png\" alt=\"\" width=\"522\" height=\"284\" srcset=\"https:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/3import_from_git.png 522w, https:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/3import_from_git-300x163.png 300w\" sizes=\"auto, (max-width: 522px) 100vw, 522px\" \/><\/a><\/p>\n<p>Eclipse should find the existing project settings:<\/p>\n<p><a href=\"http:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/4import_from_git.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-210\" title=\"4import_from_git\" src=\"http:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/4import_from_git.png\" alt=\"\" width=\"532\" height=\"374\" srcset=\"https:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/4import_from_git.png 532w, https:\/\/www.docx4java.org\/blog\/wp-content\/uploads\/2012\/05\/4import_from_git-300x210.png 300w\" sizes=\"auto, (max-width: 532px) 100vw, 532px\" \/><\/a><\/p>\n<p>(If it didn&#8217;t and you had to use the new projects wizard; be sure to set the file location to wherever your git repository is, rather than letting Eclipse create a new empty project in the workspace)<\/p>\n<p>Now you should have a docx4j project in Eclipse, and it should be properly configured (since the project settings come with the project).<\/p>\n<p><strong>You should be done.<\/strong> But if something isn&#8217;t right, you can\u00a0configure it manually (see further below).<\/p>\n<p>Next steps? \u00a0Improve the docx4j source code in Eclipse :-), then Team &gt; Commit, to commit those changes to your local repository.<\/p>\n<p>Made a change which would be useful to others? \u00a0If you forked docx4j as per step 1 above, you can push your changes to your repository on GitHub, then <a href=\"http:\/\/help.github.com\/send-pull-requests\/\">send a pull request<\/a>.<\/p>\n<p>If you didn&#8217;t fork docx4j, do that now on GitHub, then configure things locally to push your changes to your repository on GitHub, then you&#8217;ll be right to push your changes to your repository on GitHub, then\u00a0<a href=\"http:\/\/help.github.com\/send-pull-requests\/\">send a pull request<\/a>. \u00a0Other docx4j users will thank you for this \ud83d\ude42<\/p>\n<p><strong>Manual configuration:<\/strong><\/p>\n<p>Configure &gt; Convert to Maven Project<\/p>\n<p>Properties &gt; Java Compiler &gt; Compiler compliance level: change to 1.6<\/p>\n<p>Java Build Path &gt; Libraries: remove 1.5 system library; Add Library &#8230; JRE System Library .. 1.6<\/p>\n<p>Java Build Path &gt; Source: check none of the entries say &#8220;Excluded: **&#8221; (remove the exclusion)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post is old. \u00a0Please see instead 2015\/06\/docx4j-from-github-in-eclipse-5-years-on\/ docx4j is now on GitHub! \u00a0https:\/\/github.com\/plutext\/docx4j This should make it easier for users to maintain their own branches (public or private), and contribute improvements back. As of now, GitHub is the project&#8217;s authoritative version control. \u00a0We&#8217;re no longer updating the existing svn repository. Its pretty easy to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[4,85,86],"class_list":["post-199","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-docx4j","tag-git","tag-github"],"_links":{"self":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts\/199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/comments?post=199"}],"version-history":[{"count":5,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts\/199\/revisions"}],"predecessor-version":[{"id":214,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/posts\/199\/revisions\/214"}],"wp:attachment":[{"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/media?parent=199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/categories?post=199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.docx4java.org\/blog\/wp-json\/wp\/v2\/tags?post=199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}