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).
Related
So, here in the company we work with svn, and our svn server only have the source folder. When I use NetBeans, it's everything ok because I can add source folders in project and will work fine in svn. But on eclipse if i do the checkout from command line and add that folder in my dynamic web project, I can't see the svn history and nothing, svnclipse just does not work on that folder.
Our structure of the projects it's something like this
Workspace
Project folder
Project1
Project configuration files
SourceCode
Packages
Project folder 2
Project2
SourceCode
I already try to make checkout using svnclipse, but he add alot of extra config files, he turns the folder in a project and the source folder is add as a link to another project, in this scenario the svnclipse quick diff does not work properly.
There is a way to use that folder as source and Svnclipse works on that ?
Sorry if my English is not so good
There is no easy way to do what you want. In Eclipse a source control provider can only be connected to the project itself. So options are:
Use another svn client like command line or TortoiseSVN.
Create a small SVN project with the Eclipse project configuration files that also use svn:externals to pull in your source folder from repository.
With option 2, you would checkout this small SVN project from some other repository using Subclipse in Eclipse, could even be a local file:// repository and then the svn:externals property would also cause your source folder to be checked out.
I'm new to IntelliJ and trying to switch from Eclipse to IntelliJ.
In Eclipse it's done by creating a workspace and then importing the local repository. The workspace is separate from the repository. The workspace only reference the repository.
I want to do this in IntelliJ. I think the setup would be something like the project located in e.g. C:\Projects\MyProgram\ with MyProgram having .idea in it. The actual code for MyProgram would be in e.g. C:\Repos\MyProgram.git. The repository would only contain code, not config files for the IntelliJ project. Alternatively I'd like to know how this is typcially done with IntelliJ.
Typically this is done1 as follows:
git clone your repo (if you don't already have it locally).
In Intellij, open or import the root repo folder as a project.
Add .idea/ (or *.iml as appropriate) to your .gitignore file.
I'm not sure if there's a good reason for trying to keep the IntelliJ files in a different part of your filesystem.2 Some of the advice out there regarding Eclipse concerns the semantics of workspaces, which don't exist in IntelliJ.
1. To be more precise, this is how I typically do it :)
2. Although I'm happy to be convinced otherwise!
You can specify a different content root in the "More Settings" while creating a project. This location is the one where you have your repository.
I'm having trouble using EGit - specifically when pulling.
Basically, I cloned a Git repository in Eclipse using "Clone a git repository and add repository to this view" in Git Repositories view in Eclipse.
After that, I imported the Git project and used the "import using existing Eclipse project tab".
However, this changes the names of the packages. Instead of having a src folder that contains all the packages ("Model", "Controller", "Player" etc), it changes all the names to the packages to "src.Model", "src.Player" etc.
This is what the remote repository looks like
And this is what happens when I import the git project:
Because the package names had changed, it would compile. So initially I changed the package names back to their original (src.Player -> Player). However, when I pull, it changes all the package names to start with src.
Is there any way I can fix this?
Thank you
Your project folder instead of src is configured by mistake as a source folder:
In Project > Properties: Java Build Path, in the tab Source remove the project folder and add the src folder instead.
Commit and push the file .classpath which stores this project-specific setting
I am trying to import an existing git repository as an eclipse project. The repository is stored in the location ~/src/repo_dir, and ~/src/ is my eclipse workspace directory.
If I use the sequence of menu operations:
File --> Import --> Git --> Projects from Git --> Local --> (Select my repo)
--> "Import as General Project"
I get the error:
/Users/me/src/repo_dir overlaps the location of another project: 'repo_dir'
and I can't import the project. It seems to be because Egit does not want the original repo that is being imported to already be in the workspace. However, if I then move the repo_dir out of the workspace directory ~/src/, and then import the project via the method above, it doesn't copy the contents to the workspace directory, so now my files live somewhere else, which is undesirable. The only workaround that I have found is to move the repo out of ~/src, import it, delete the resulting project, move the repo back into ~/src, and then import it with git as an 'Existing project.' Does anyone know of a cleaner way to handle this?
There are two different issues here:
Git handles a selected folder in your computer as a repository - and also stores some git-related metadata in it.
Eclipse handles a selected folder in your computer as your workspace. It stores that Eclipse configuration files (not meant to be shared), and even worse, it expects a single-level folder hierarchy for projects.
This means, putting a Git repository inside the workspace might cause a lot of unwanted issues - so I do not recommend this way (even if by some hack it is workable). However, if you want to organize all stuff related to an Eclipse workspace, you could create a folder structure as this:
eclipse-stuff
workspace
git
git-repo1
git-repo2
The workspace folder is given to Eclipse as the workspace folder, while git-repo1 and git-repo2 are your Git repositories.
On the other hand, I like to put all my git repositories into a common folder, regardless of the Eclipse workspace I use them in, but if you want to organize contents, this might not be enough for you.
Had this problem with Eclipse Kepler.
End up with installing Eclipse Mars and import the new project in another workspace.(Luna will also work fine)
If you need to work on current projects and set up environment for the coming one...
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