Subversive Eclipse Error - Switch Operation Failed. - java

I have just started to use SVN and have run into a bit of trouble. I dont really know what to do about the following error:
Switch operation failed.
svn: Failed to add file '.classpath': an unversioned file of the same name already exists
I tried switching from my branch to my trunk and then back to my branch. Now I cant switch to either. Any help would be much appreciated as I am a complete noob when it comes to SVN. Thanks.

In your file system there exists a file named .classpath which is not in your SVN. But in your SVN branch there is also a .classpath file.
I would talk to the team if you want to store the .classpath`-file in the SVN or hold an individual one for each developer outside the SVN.
What I would do:
Rename your local .classpath to e.g. .classpath_local
than checkout the one from the SVN and compare both files.
If you can live with the one from the SVN, fine, if not talk to the other team members if you should remove it from the SVN so that everyone can have its own version.

Related

Update changes from Bitbucket to local git repository in Eclipse?

I have a repository on bitbucket and I was able to successfully import the repository to Eclipse to work on the java files but I've run into a problem. I can't seem to update Eclipse to accommodate for the commits made to the Bitbucket git repository. I've tried to import again and and I used pull but none of the changes appear on eclipse. When I try import it says the .project file already exists in the directory. When I use pull it says everything is up to date so I figured I'm using pull incorrectly. Can anyone help me out?
You should precise more details to get an answer.
If you did all the steps correctly, for example from this tutorial:
http://crunchify.com/how-to-configure-bitbucket-git-repository-in-you-eclipse/
you won't have problems.
Try to delete all the files from the folder that you have imported, and try again.
When I try import it says the .project file already exists in the directory
That is expected: you would need to delete the project from the eclipse workspace (not from the disk) to reimport it again. But its content would be identical.
Check a git status on the command line to see if you are on a branch or in a detached HEAD.
You can also see it in the history view of eclipse.
A detached HEAD would explain why a pull doesn't refresh anything.

Eclipse not recognizing changes in code

A friend and I are working on a java project in Eclipse. Whenever we "ship" a new version we export it to a runnable jar.
It seems whenever we try to send the file back and forth (over google drive) to work on separate parts of it something gets messed up. This doesn't happen for him, but when I download the file from Google Drive, Eclipse does not recognize any change I make to the src.
It doesn't matter how many times I change the workspace, move/ rename the file, clean/ build the project. Nothing seems to be solving this problem. Any advice on why this is happening and how to fix it?
It would be infinitely better for the both of you if you looked into some kind of source control system, as opposed to a file sent through a file sharing service.
Sharing the source code in a JAR doesn't allow you to:
Keep a revision of known working code, in case something breaks
Reliably import the code
Keep track of changes (who did what to what file, etc)
Look into something that's suitable for sharing between users. GitHub and BitBucket both offer free Git hosting, which is a very popular source versioning tool.
Eclipse is probably building the new version of the runnable JAR in the project's output directory, which by default is something like %PROJECTDIR%/target. The new version of the JAR with your changes will be there, and you'll have to export them again to trade files back again. See also: How do I change a Java project's bin folder in Eclipse?
it is probably because it is not updating yours .class, try delete .class of "target" folder of your project, make clean (project - clean) and save again the changes
There are many steps where you can solved it,
Clean Project and Re-Build
Remove .metaData and .settings from Workspace
Clear cache
In my case, I have tried much more and I got to resolve it by removing Classes, test-classes folders if Its there in Target folder

How to checkout an old revision using Subclipse subversion

I need some help checking out a java project from a SVN repository. In order to validate my work, I created a test java project in my local workspace, and am able to create a jar file of it. But I can not do that with the project that I check out from SVN. This is a project, which others have successfully checked out. Before I started I knew very little about SVN, so I read this url: How to use Subversion with Eclipse
I am using subclipse v 1.6.18
I choose checkout after right-clicking the repository from repository perspective. The developer of the code told me to use revision 10. So I click the selection button, and from the list of revisions I double click revision 10. and click on Finish. !
I also choose the "check out as a project in the workspace" and call the project javacardreader.
Unlike the tutorial I saw on youtube about SVN. I do not see any option to synchronize with the repository in the java perspective. I do see the javacardreader project in my java perspective. But when I try to create a jar file from it, the folder does not show up as an option like my other test project.
I also do not see an option for adding the binaries to SVN ignor in my list.
My question is what am I doing wrong? My understanding is that revisions are changes / improvements that developer(s) make to the code. One question that came up in my discussion with the developer was if I am pulling the committed code. How can I make sure I am doing that? Where should I look? Am I missing something about how SVN works?

Cannot convert project... Premature end of file error in Intellij IDE

I am using Intellij IDEA as an IDE for running Java programs. Dues to power fluctuation computer got restarted. Now when I launch the IDE after reboot i am getting the error Cannot convert project: /home/aniket/IdeaProjects/JavaDemoCodes/.idea/workspace.xml: Error on line -1: Premature end of file.
Has anyone encountered this situation before? What can I do to view my project back again?
I also had this after a power failure, I simply deleted the workspace.xml file from the projects .idea folder, restarted IntelliJ and it seemed to be OK apart from loosing which files were open.
Cheers,
Nick
I had this exact error when my laptop bluescreened. I solved it by:
Exit IntelliJ IDEA
Rename .idea folder
Start IntelliJ IDEA
Create new project from existing sources
Exit IntelliJ IDEA
Copy all files from old .idea folder to newly created one.
Restart IntelliJ IDEA
Finally solved the problem. Hers is the solution. First of all I had two Intellij IDEA projects open in two separate windows.
One was the project which had corresponding subversion repository. This was a file-based format project. Files that define a project are .iws, .ipr and .iml. .iws is the one corresponding to the workspace configuration. I just reverted back this file with svn revert project.iws and I could launch my project again.
But the problem in second project JavaDemoCodes still persisted as it was custom project I created and it looks by default we get a directory-based format project instead of file-based format project. This has all its configurations in /home/aniket/.IdeaIC12 directory. As many of you suggested i searched for workspace.xml here but could not find it. I tried find . -name *.xml but i still could not find it(Also as the error suggests there is no file /home/aniket/IdeaProjects/JavaDemoCodes/.idea/workspace.xml ).Finally I did import project from my first project(the one with svn repo) it detected my JavaDemoCodes project as Intellij IDEA project and let me open it in new window.
Not sure if this is the perfect answer but it solved my problem and yes as someone suggested I deleted .iws file from my 1st svn repo based project and tried to restart but was of no help. New .iws file was created but it still gave me the same error.
I have experienced this same problem. It happens to me when I have IntelliJ open and for whatever reason (usually problems with having multiple VPN connections open), my computer freezes and I have to do a forced re-boot.
My solution is to use Windows 7 restore. I'll go to the folder it is complaining about, right click on it, and do a restore. If I'm lucky, I have a restore point only a few days old.
For me, rebuilding my configuration on several projects from scratch is too time consuming. Using a restore point from a few days or even a week makes more sense.
Good luck.
I solved it just by creating a new project, then starting it and then reopening the old project..

How to properly delete Java packages under SVN control?

I hava a Java project and am using Eclipse (Indigo) with the Subversive SVN plugin. I have successfully setup a remote SVN server that I'm using for the project repo.
I recently decided that I no longer needed a package that had a few unused classes in it. So I did the following:
I deleted the package and all of its contents from inside Package Explorer
I then right-clicked my project's root directory, and went to Team >> Synchronize with Repository
I found the newly-deleted package showing up in the list of changes under the Synchronize SVN panel, right-clicked the package, and select "Commit". My thinking here was, "I've deleted the package locally, now I want to commit those deletion-changes to the server."
The changes were not committed, I got an error message (which I failed to look at...) and now this is what I see back in Package Explorer (the net.appuzi.domain.loads.http package is the one I deleted):
Now, if I go back into Team >> Synchronize with Repository, I see the package like so:
If I select both Java sources and try to "Override and Commit" them, I get the following error:
Some of selected resources were not committed.
svn: Commit failed (details follow):
svn: '/<path-to-my-project>/MyProject/src/main/java/net/appuzi/domain/loads/http/HttpMethod.java' is not under version control
So my immediate question is: how to "synch" my local working copy and the repo so that this deleted package no longer exists in either one (on the server-side I'm committing to trunk/).
Besides that immediate problem, which is my current blocker, I guess the next logical question is: what are the proper procedures for deleting packages that are under version control in SVN.?" Thanks in advance!
Try making sure that your local files are the same as the remote files before trying to delete. That way the only change being detected is the deletion of the entire files, and Eclipse won't get confused about conflicts. Just update or revert as necessary and then try deleting again.
Try this:
delete the packages.
right click on your project inside the project explorer.
go to "Team" and click on "Update to HEAD.
again go to "Team" and click on "commit...".
Good Luck
I had similar issue earlier, all I did was committing parent folder. In you case "src". Get those files back and delete them again, and this time commit the parent folder.
Hope this helps.
Just delete the folder using Svn repository exploring, then update the project.
I had a similar issue where the package got deleted from the SVN repository but still showed up in the Synchronize View in Eclipse. I have the subversion plugin installed in my Eclipse. To resolve my issue, I disconnected the project from SVN (Right Click on Project --> Team --> Disconnect...) while opting to check the option "Also delete the SVN meta information from the file system."
Once disconnected, I reconnect the project to SVN, synchronized with the repository once more and the deleted package/files were no longer visible in the Synchronize view.

Categories