top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

How to upload the Maven Project from Eclipse to GitHub

Hi All,

I would like to write about the significant challenges and difficulties that my team members and friends encountered when trying to upload the maven project to GitHub.


Let me start with what is GitHub? In simple terms, it is a web-based platform for storing, managing, and sharing code, software projects, and other collaborative work. It’s a place where individuals and teams can work on software development, track changes to their code, and collaborate with others.


Maven is a powerful build and project management tool that simplifies project setup, dependencies, and build processes.Helps to manage the build lifecycle of a project, which includes chores like compilation, testing, packaging, and deployment. Additionally, it manages project dependencies, which simplifies the handling of third-party frameworks and libraries.


Here is the sample maven project in eclipse IDE with screenshot attached below


Maven Project


Step 1:

Login to GitHub repository and create a new Repository to store the project. A repository is like a folder that contains all the files, code, and resources for a project. You keep your work there. When the repository is first created, it appears as shown in the screenshot below.


GitHub Repository Initial View


Step 2:

Create a personal access token for your project by going to Settings->Developer settings->. Then, select No Expiration from the drop-down menu and enter the name of your token.Give access to “repo” under the Select Scopes option so that you can use the token rather than the login and password that it always requests. To utilise the token in the project, click the “Generate Token” button and copy it.The screenshot for reference is provided below.


GitHub Settings


Step 3:

Copy the GitHub address as seen in Step 1 Screenshot, Example:https://github.com/VidhyaM09/Sample.git

Go to Eclipse workspace > Window > show view > others > Git > Git Repositories > open

Click on “Clone a Git repository” > clone URI > Observe in the window the URI, the token we copied will be automatically filled in there. click Next->Next->The Local folder will be created under git folder in your system.Finally click Finish button.We will be able to see the locally generated repository in the local system, as seen in the screenshot below.


Sample Repository at Eclipse Workspace


Step 4:

Right click on the Maven project > Team > share project. A window will appear where you will select the repository location to place your project.If you observe, you can see the current project location and the target location.Click Finish.You will see the project has been connected to Git,but it will not be shown in Github repository. So we need to push the changes.


Project Structure


Step 5:

Pushing the changes to the GitHub repository is done by selecting Window > Show View > Git Staging > Open.Mvn clean should always be performed before committing any code.There are numerous files in the unstaged changes.Drag and drop the files to the staged changes after choosing the ones that are needed for the project. The files’ screenshot after being dropped under staged changes is shown below using the phrase say(“Helloworld.java”).


Staged Files


Step 6:

Enter the commit message say “First commit” in the opened Git staging window and click Commit and Push.


Git Staging


Here you go, you can see the screenshot as below


Code Pushed Confirmation


Step 7:

Close the window and go to Github repository where you want to place the project. The code that has been committed will be visible if you reload the page or navigate to the project’s directory, as shown in the screenshot below.



GitHub with added Project


Sample Java Program in GitHub




Changed code in Eclipse and pushing the code changes to Github


Step 8:

Click Commit and Push and you will get the Confirmation Pop up Window.click "Close" button.


Final code changes has been reflected in GitHub


Conclusion:

Uploading your Maven project to GitHub is a valuable skill that can enhance your development workflow and open doors to collaboration with fellow developers. It's a versatile platform for modern software development, helping teams and individual developers manage their projects more efficiently.You will be fully aware of the sharing your work with Github by following the instructions provided in this guide. If you have any questions or want to share your experiences, feel free to connect with me on Twitter(@VidhyaAkshu) or visit my blog (https://medium.com/@vidhyamanickaraj ). Happy coding and happy collaborating!



69 views0 comments

Recent Posts

See All

Комментарии

Оценка: 0 из 5 звезд.
Еще нет оценок

Добавить рейтинг
bottom of page