This brief howto discusses several ways to copy a GitHub Java project into your own workspace so you can edit, compile, and run/test it.
This method is highly discouraged because it is tedious and error-prone.
- Create a new project in your development environment, such as IntelliJ IDEA.
- For each file in the GitHub project you are copying, create a file in your new project, then copy and paste the contents of the original file to your local file.
Common errors introduced by this method are wrong project folder structure, missing files, missing code, etc.
In addition, if the code depends on any external libraries, you will need to add these to the project manually as described here.
When using the last three methods, your development environment should automatically recognize any external library dependencies based on the Maven project configuration file (pom.xml).
- Look for the green button in the upper right of the main project page on GitHub.
- Press the button.
- Choose "download as Zip".
- Move the downloaded zip file to your local project folder.
- Extract the zip file in your file explorer/finder to a folder.
- In your development environment, choose "open project" or similar, navigate to your local project folder, and open the subfolder extracted from the zip.
This method is suitable if you want to submit your project as an exported zip file.
- Look for the green button in the upper right of the main project page on GitHub.
- Press the button.
- Choose "clone" and "https", then press the copy button (or copy the project URL shown).
- In your development environment, choose "get from VCS" or similar, enter the copied repository URL in the corresponding field, and press "clone".
Note that this method still requires you to submit your project as an exported zip file.
- Follow the process described here.
- When using GitHub classroom (stay tuned), the same process still applies, except that you no longer need to import the repository yourself because GitHub classroom does this automatically.
- Now your local work gets pushed to your hosted GitHub repository, and you only need to submit that repository's URL for us to have access to your work.