I can't run JUnit in Eclipse for git project - eclipse

I am trying to work in GitHub project and I need to understand the code
so when I go to Run as I have just Run configuration
* I installed JUnit plugin for eclipse
that is the my screen:

You should import hipster-examples as a separate project, so that eclipse recognize the src folder as a source folder.
try to create a new empty workspace and follow this steps:
righ click on package explorer
Import...
Existing maven projects:
set as root directory the root path of your local git
repository - using your example as a reference, what I mean is the root path of "hipster" project and select all the projects:
Now everything should work fine:
As you can see in these screenshots, as a result, there is NOT one single project containing everything, but there are all the projects, each of them declared as a "root element" of the workspace.

Related

EGit creates separate project folder in repository

I'm struggling to create a repository for my Maven project in Eclipse. Whatever I try it turns out like so:
\ProjectA
----\.git
----\ProjectA
--------\src
--------\pom.xml
While I'd like it to be like so:
\ProjectA
----\.git
----\src
----\pom.xml
Is there any way for it to not create a separate folder under the working tree?
I'm not sure if it is the only or the best way, but creating empty repo from git directly then moving files and reimporting in Eclipse did the trick.
In case anyone needs this later:
In folder you want your repo in:
git init
Copy your sources and pom.xml and other needed files there (I also recommend creating .gitignore file at this point), then:
git add --all
git commit --m "Initial commit msg"
Then open Eclipse, delete your project and reimport it as existing Maven project directly from your repo. In my case it already recognized repo as well.
From my understanding, you are trying to create a Git repository with a single Eclipse project, located at the root of the work directory.
open the EGit Repositories view and select the Create a new Repository action
enter the name of the directory in which the repository should be created and select Finish
make sure that auto-sharing projects is enabled (enabled by default, in doubt, see Preferences > Team > Git > Projects)
open the New Java Project and enter a project name
uncheck Use default workspace location and enter the exact same path as the repository work directory (see 2.)
go to the Package Explorer, select the new project, open the context menu and select Configure > Convert to Maven Project
The detour of creating a Java project first and then converting it into a Maven project seems necessary because the New Maven Project wizard apparently always adds the Group Id to the location path.

Importing GIT project into eclipse mangles package names

I'm trying to import a GIT repository into my eclipse (luna, 4.4).
The imported packages have "src" prefixed to the correct package name.
E.g. instead of com.myproject.test I see src.com.myproject.test.
I'm a GIT newbie. Any insight is greatly appreciated.
Your .classpath file was not committed into the repository, so Eclipse does not correctly know where the root of your sources are. Bring up the project's Properties Dialog (use the context menu or the main menubar's Project menu) and go to the Java Build Path page. On its Source tab, you can remove the project folder itself and set src as the Source Folder to use (not that you're limited to just one in the future).

not able to import github project in eclipse

just created project on github from my office and when then i came home and was trying to import the project on my home machine but I am not able to do it.
Following is the detail.
Both home and office machine has eclipse Juno and Egit plugin installed. I am able to do check-in from office. but at home I am not even able to import the project.
my workspace directory - c:\gaurang
git local directory - d:\Gaurang\Webdriver-Data-Driven-Framework
Now if i choose "Import existing projects" it says No project found
if i choose "Use the new Project Wizard" - it creates empty project
if i choose "Import as general project" - it creates the project but not a java project so not able to compile or run.
My git repository - https://github.com/Gaurang033/Webdriver-Data-Driven-Framework.git
I struggled in a similar fashion when checking out https://github.com/angular/angular-seed.git
The problem was that I expected to happen in a single step. The Github project does not contain eclipse files, so of course you can not import existing projects - the other options should work, however and they don't
The solution for me was to:
Clone the github repository locally e.g. /home/name/git/angular-seed (import.../Projects from Git/URI)
Obtain a working copy as a plain project (import.../Projects from Git/local)
I think it's a bug
The result is that I have the cloned repository in /home/name/git/angular-seed and a skeleton project with a ".project" file that points to that place
You have to push your .project and .classpath files to the repository if you want to be able to import the project using the "Import existing projects" wizard. If those are not present, eclipse cannot detect an existing java project.

Import an existing Git project into Eclipse without a .project file

I've forked and cloned a project to the local machine from GitHub using the terminal and am trying to import it into Eclipse.
The problem is the clone from GitHub doesn't have a .project file, so when I go import -> projects from Git, I can only import as a general project. How can I import the project to Eclipse without doing git init? Most of the solutions I saw have .project already there when they cloned it from Git.
Create a new java project, Untick "Use default location" and browse the git project path by clicking browse button. It works for me. I have just imported a Git, netbeans project into Eclipse through this simple method.
After a while I got it working as expected...
Basically the wizard is broken. This is what worked for me (eclipse 4.2.2):
You may use the wizard to import the git repository to your workspace.
After that you need to close the wizard and open the git Repositories view. (Window->Show View->Others->Git->Git repositories)
Right click on the repo you've just imported and select "Import Projects..."
I've imported a general project (it was SQL code only) and this time it worked as expected (The screen doesn't allow you to change the project name nor directory, which makes sense at this point.)
Those are the same steps performed by the wizard, but apparently it doesn't get the information about the project being already deployed at the workspace, so you get the option to change those values and it complains about the project already existing there.
You should create a new project in Eclipse and specify that the project be located in the existing directory.
Choose "Create project from existing source" in the wizard:
I use eclipse 3.7 ( indigo ) and I find this great solution:
1) click on: Navigate -> Show In -> Project Explorer
2) from Filesystem folder, find and select the folder where the project is contained
3) right chick on folder, and select Promote to Project
Do this:
File > Import > General > Existing Projects Into Workspace
then:
select root directory: select the path in you pc where the project is
if you want to to copy the existing project in a new project into your workspace, check the field copy projects into workspace, otherwise don't check it and continue to work directly into the existing project

How to connect/sync just the src folder of the maven project in eclipse workspace to src folder in repository

I have commited just the src folder and pom.xml of maven project into SVN repository in order to make it independent of IDE (As .settings, .project etc are files specific to eclipse ide)
Then when I'm trying to import the src folder in a newly created maven project (as it has the other files which are needed to run the project in eclipse), basically I only want to synchronize the src folder and pom.xml with the repository, I get a warning while I import the src folder 'as a folder in existing project' AS 'Destination project is detached from the source control. So please take into consideration that the plug-in won't provide any SVN actions for these resources' and then I'm not able to use Compare with and Team Options. It doesn't even show the revision no. besides the imported class files and folders.
Is there a way to do this ??
What is/are the usual industry practice/s ??
There're 2 options.
1.) Check out the SVN files using some other tool e.g. (TortoiseSVN) and then import the maven project using 'Materialize Maven Project'. This will create necessary metadata for eclipse and will also maintain the version info for the checked out project. See this reference http://www.sonatype.com/books/m2eclipse-book/reference/creating-sect-importing-projects.html
2.) The (better) other way is to download 'Maven SVN Integration' plugin using update site
http://m2eclipse.sonatype.org/sites/m2e-extras/. Once you install the plugin, you would be able to see option 'Check out as Maven Project' in SVN repository exploring perspective.
Thanks,
Prabhjot