Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
225 views
in Technique[技术] by (71.8m points)

java - Import Gradle Project from existing GitHub Repo - Eclipse>Team>Fetch from upstream not available

Using two methods unsuccessfully to import existing gradle project into Eclipse workspace. Method 1 allows me to checkout remote branch, make changes and commit & push to existing repo but does not allow me to build locally via Gradle Tasks view > build > build. Method 2 allows me to build but does not allow me to checkout remote branch.

Question : How can I properly import a gradle project from a github repo and be able to build it locally and checkout a remote branch at the same time? Am I missing a step somewhere?

First I imported a gradle project from an existing github repo with :

METHOD 1 : add URI to clipboard Eclipse>File>Import>Git>Projects from Git>Clone URI> paste URI (should auto populate) > Next > Select branches to clone > choose Local Destination i.e. eclipse-workspace > Import as existing Eclipse project- Yes > import projects from a Git repository > Finish

With the above, I was able to use Team>Fetch from upstream, checkout my new branch and make commits however the project will not show in Gradle Tasks as I need to build the project locally.

Next, I deleted the project and added to my eclipse workspace again with this method :

METHOD 2 : Download zip from github into your eclipse workspace directory (Whatever you named it. You could have many) unzip project and move to root of eclipse workspace directory. remove "-master" from project directory name. In Eclipse : file>import>Gradle - Existing Project, Next > Gradle Welcome Screen, Next > Browse to root directory of project, OK. Next > Gradle wrapper should be selected. Finish > open Gradle Tasks from Window>>Show View>>Gradle Tasks > verify that your new project is listed in Gradle Tasks > build project locally in Gradle Tasks with Project Name>>build>>build > verify build in console also steps in Gradle Executions tab

So with this method I can build the project just fine but now Team>Fetch from upstream not available as I need to checkout my remote branch and make changes. Project does not show in Git Repositories view either. There is no .git file for this project when I import the gradle project with the second method.

question from:https://stackoverflow.com/questions/65941896/import-gradle-project-from-existing-github-repo-eclipseteamfetch-from-upstre

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...