Last active
August 29, 2015 14:08
-
-
Save BurntPizza/a6d7ae1d1bb74f65c5c9 to your computer and use it in GitHub Desktop.
Eclipse git clone -> general project -> java project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File > Import | |
Git > Projects from Git | |
Clone URI | |
Enter info, icl. clone URL from GitHub. If it's in your clipboard most should already be entered. | |
Select branches, local repo directory, etc. | |
If eclipse project file is not present in repo: (likely and troublesome scenario) | |
Import as general project | |
Name > Finish | |
Now you have the project, linked with a local git repo and the remote repo (presumably on GitHub). | |
But it's a "General project," and cannot be compiled or run. | |
Conversion to Java project: | |
Go to project directory, open .project file in a text editor. It may be hidden. | |
Add some things: | |
```` | |
<buildSpec> | |
+ <buildCommand> | |
+ <name>org.eclipse.jdt.core.javabuilder</name> | |
+ <arguments> | |
+ </arguments> | |
+ </buildCommand> | |
</buildSpec> | |
<natures> | |
+ <nature>org.eclipse.jdt.core.javanature</nature> | |
</natures> | |
```` | |
So now it will build, but run any src folder is probably still borked and every package declaration is "wrong." | |
Fix: | |
(Right click on project "run as" or "Run" menu) > Run configurations | |
Set name, main class, etc. if not already. | |
Classpath Tab: | |
Click "User Entries" | |
Click Advanced | |
Add Folders | |
Select to your project's src folder, and any other source folders. | |
OK > Apply | |
One more snag might be compiler/JRE settings: | |
Right click project > Properties > Click "Java Compiler" | |
Note any warnings at the bottom, usually just set project to your highest version JRE and compiler compliance. | |
Note that if you are contributing to a project, they might want a certain compliance version. | |
Of course a project might also require libraries. | |
Right click project > Build Path | |
Add External Archives OR Configure Build Path > Add JARs if they are in workspace (included in project) | |
<<< Heavy WIP below >>> | |
If the project is a github fork, and you want to be able to pull from the original repo you forked from, | |
you're not done: | |
Window > Show View > Other > Git > Git Repositories | |
Right click project repo > Properties | |
Click remote > origin > url | |
Add Entry > key = "remote.origin.url" value = URL for original repo > OK | |
Right click project > Team > Remote > Configure Push to Upstream | |
URI field: "Change" > put in URL for your repo, and your user creds. | |
Now "Pull" should pull from both repos, the parent and your fork, but only push to the fork. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment