Import Java project from GitHub to Eclipse - java

I'm trying to import a project on GitHub into eclipse because there are a few things I want to add to it. However whenever I add it I get a ton of errors and problems with it...
The GitHub project is https://github.com/dmulloy2/SwornGuns
I've tried adding it to eclipse and it didn't work. I then tried making a project in eclipse and then put the files in, that didn't work. I also read online that going to Configure -> Convert to Maven Project would work, and then importing the spigot.jar file that this source depends on. However that didn't work and just gives me a ton of import errors.
The errors I am getting:

That project is a maven project. A simple way is clone that project into your machine, and import it as a maven project, with File - Import - Maven - Existing Maven Project.
Eclipse will help you resolve the pom file and configure project and download necessary libs.

First, make sure you are using Luna, the most recent version.
In eclipse, File > Import > Git > Projects from Git > Existing Local Repository.
In the Import Projects from Git screen, click add, then goto the location of the cloned repository. Click open, finish, then next. Select Java > Java Project, and click next again.
At this point, there are three options.
Import existing projects
Use the New Project Wizard
Import as General Project
Pick "Use the New Project Wizard". Then, uncheck "Use Default location", and click browse. Select a folder (You probably want the location you cloned the repo to), click "Open", and give the Project a name. Click next, and make sure that the src/bin folders are setup correctly, and click finish.
Whew!
Of course, the Import from Git option was only added in Luna, so update eclipse if necessary.

Related

Cannot import maven project in IntelliJ

When trying to open a maven project through the pom.xml, IntelliJ shows the windows: Open project, when I click open as project I can see the window: scanning maven projects. I can't get to the window open in current window or new window.
When I try to open a non-maven project, it opens it. When I try to open a maven project as a normal project it doesn't seem to do anything.
I have successfully opened a project as maven project through cloning it from Git, bit it gives me errors that it can't import the maven dependencies.
I can do mvn --version, mvn clean compile etc.
I have tried to open projects without the .idea folder and with the .idea folder. That didn't work.
I have reinstalled IntelliJ already.
EDIT: I am using IntelliJ version: 2018.2.4 Ultimate.
EDIT2: I just noticed that the blue color that usually appears by a pom.xlm is different, see screenshot.other color?
To import a maven based project in intellij Idea follow the following steps:
Open intellij idea,
Goto File menu,
Click on New,
Click on Project from existing sources,
Select file or directory to import,
Select POM file ,
Click on OK,
Finalize the other steps,
wait till the import loading gets completed(Sometime it takes much duration to complete)
Your project will get loaded with files and folder on left side.
Do you have an exception in your firewall so IntelliJ can make http requests?

Import Eclipse project into IntelliJ while keeping them synced

I'm trying to import Eclipse Project to IntelliJ while keeping them synced, because I want to use IntelliJ as an IDE but keep Eclipse project in the way it is now and if it anything, directly upload my programming assignments (as an Eclipse project). In other words, I want to edit Eclipse project with IntelliJ IDE, that's all.
After some searching, I discovered that you can do that in IntelliJ Like that:
Import project -> [Choose .project File] -> Keep project and module files in [some other directory] & Link created IntelliJ IDEA modules to Eclipse project files -> [Select project to import, "Empty Karel Project" in my case]
However, no .java files in my project whatsoever. That's where I need help. Am I missing or misinterpreting something? By the way, Eclipse Integration plugin is enabled.
Project files after importing:
IntelliJ IDEA allows you to import projects from Eclipse in two ways. If you do not need backwards compatibility, you typically instruct IntelliJ IDEA to create a new set of native project files. Otherwise, you can instruct IntelliJ IDEA to keep project files in sync so that you can work on the project from both environments.
Click Import Projectfrom the Quick Start window or select the File → Import Project ...menu item. Next, select the .classpath file or .project file to import and confirm.
And for other ways you can refer below link
https://confluence.jetbrains.com/pages/viewpage.action?pageId=59944389

Import Maven multi-module project into Eclipse

How do I properly import a Maven multi-module project into Eclipse? When I import a new Maven project and select the parent pom, I can see the submodules under the parent pom which are visible in the package explorer and project explorer. However, they are presented as a deep directory structure, as if Eclipse doesn't know they are Java projects.
When I expand the submodule project, I don't see the Java package shortcuts as I would have if I opened a single Maven project. I only see it as a deep directory structure. How do I import a multimodule Maven project and open the submodule project to take advantage of Eclipse Java project features?
Install M2E Plugin from Market if it is not already installed
From Eclipse IDE choose "File" and "Import" from toolbar. That should
lead you to a pop up.
Type "Existing Maven Project", or navigate to this under
Maven settings.
Then select the main pom project from the import menu, and be sure
to select entire tree of projects under it.
Before approaching this clean the IDE from the currently wrong imported project, deleting its Maven root pom project and every submodule, but leave them on the disk obviously.
I don't recommend the "Convert" options as sometimes that doesn't lead to clean results, especially with big and messy projects.
First, import the parent project. Then, right click on it at the package/project explorer, go to Configure and then click the Configure and Detected Nested Projects..., on the window that will appear click Finish and you're gold.
Also worth mentioning, Package Explorer won't show it nested, use Project Explorer instead.
Have a nice day.
For everyone who still have the same issue, follow these steps:
Open Import Existing Maven Project wizard
Select the Parent POM.xml only and click Finish
Foreach child project, Right Click on the project folder, then click on Import and select his POM.xml file
Hope it helps ! Good Luck !
If you are using git or any version control. Clone the repository first in local.
Steps already explain by #Black Jack. Adding image to support
Step 1
Navigate to project folder.
Open command prompt (or shell)
Run mvn eclipse:eclipse
Step 2
Open eclipse IDE
Open project from File > Open Projects From File System...
Select folder of project containing parent pom.xml file
Step 3
Run Project > Clean from Menu
Step 4
Run File> Restrat From Menu
Solved my problem in Eclipse 2019-06(4.12.0) and 2018-12(4.10.0)
Important trick
When you start to search for files in 'open resource' (for example using Ctrl + Shift + R) eclipse will show file from two address. for example MySampleFile will be available under:
parent-module/sub-module/src/main/java/.../MySampleFile and
sub-module/src/main/java/.../MySampleFile
Use second one. Opening file with first one will not activate IDE features on that file.
To add a few on top of #BlackJacks answer, ensure that the parent pom in the root of the directory that contains sub-projects contains a modules section:
<modules>
<module>module1</module>
<module>module2</module>
<module>module3</module>
</modules>
So, after the import, unlike IntelliJ, Eclipse opens the sub-modules as separate projects, apart from the main root project.
Hope this helps!
Follow the steps
Choose file menu
Click on import
Select project right click then Convert --> Convert to maven project
Click on import then type or select Existing Maven Project
Now your moduled project in you workbench. If you have any query we can discuss.

can not build imported source from git JAVA

I use eclipse for my java coding and just imported some java source from git with below method.
(right click --> import --> projects from git)
it seems codes were downloaded successfully but I can't build it.
in menu bar, Project --> Build project is not working for my downloaded source.
someone said "check your project icon in the package explorer, your little "J" on the files is too faint it means you did not commit your project metadata files properly". how can I fix this issue? please refer my picture below(my current issue) and give me your kind advice.
my current issue
Personally, i always clone project from repository using terminal and command:
git clone <repo url>
and then in Eclipse, import existing project directly from hard drive.

How do I import gradle projects with with EGit in Eclipse? (libGDX)

I am quiet new to git but for now I have set up a repository on Bitbucket. The repository contains my libGdx Project which is gradle project containing 3 sub-projects (Android, Desktop and Core).
So now it is my aim to clone this to eclipse using EGit. Everything works until i have to choose a wizard for the Import of the projects.
After i added the repo i use Import > git to Import a Project from the added repository
Here i have to choose the wizard
If i choose "Import existing Projects" the program tells me that no Projects are found.
After that i tried the "Use the New Project wizard" but it confuses me and actually i want to Import a gradle Project and not create a new one.
The last Option "Import as General Project" gives me just Folders and files, so eclipse doesn't notice the existing Projects. Like i said i'm quiet new to git so i appreciate every help ! :)
Thanks :)
The wizard intends to create the project settings files for Eclipse (.project and .settings/).
It seens like you don't have them in your git repository (I don't think you should). That why Eclipse asks you to create a new "project".
the best way is "Import -> Gradle project" (you need to have gradle plugin installed in eclipse first)
But is you don't want to use gradle plugin you need first to generate eclipse file. To do so, type "gradle eclipse" in your working directory (see https://docs.gradle.org/current/userguide/eclipse_plugin.html) and then import existing project into your eclipse workspace.
Another thing, it seems that your workspace is in the same folder as sources (.metadata folder), you should create your eclipse workspace in another directory.

Categories