subversion with turtoisesvn, visualsvn manager, eclipse and maven - java

I'm trying to setup Apache Subversion on my PC, but I'm not sure about the workflow.
I've created a repository in the VisualSVN Server Manager console. I've created a project structure within that repository, where a folder called MyProject has three folders called /trunk, /tags and /branches.
Then I created a folder on my disk called MyRepos. Within that folder I created another folder called Java_Projects. Into that folder I checked out MyProject folder. This is my working copy, right?
Now I created a maven project inside the trunk (in the working copy folder where I checked out to) and the trunk and converted it into an Eclipse project, so the trunk now contains the src and target folder, the pom as well as the .project and .classpath files.
Then I imported this project as "existing project" into the Eclipse workspace.
I then wanted to delete the two java-files automatically created my maven. It wouldnt let me do that in eclipse. So I deleted them directly from my disk, from the trunk folder.
Then I created two new classes in eclipse and commited the whole project from within eclipse. But the two files I created in Eclipse are neither visible in the VisualSVN Server Manager console nor in my local copy. I've tried commiting in Eclipse and updating in the trunk folder several times, but the files dont show up.
What am I doing wrong? How do I, after having created a project-structure in the repository (which in my case is controlled by the VisualSVN Server), create a new maven project and work with that?

If you used svn checkout to get MyProject from the repository, then 'Yes' you have a working copy of this directory,
Use svn st -v to analyze status if items your working copy. I guess that you've performed some file operations without using svn client thus you will see missing and unversioned items there. You have to perform copy / move / delete / rename operations using svn client only. Otherwise you can get missing / unversioned items in your working copy.
Read SVNBook.

Related

Accidentally made my Netbeans Project folder a github repository

I've just finished a java course and a project in which we made a small java application. In the project we used github, but since we're all pretty much beginners to java and github this was a rather confusing process.
Therefore I might have made my NetBeansProjects folder, which is NetBeans' default folder for new projects, a repository to our project on github.
At least what happens is that every time I create a new project in NetBeans, it's automatically connected to our project on github.
I'd really like that my NetBeansProjects folder isn't connected to any remote github projects.
I have tried the git remote remove origin which resets the config by the looks of it but it doesn't solve the problem and any projects I create in NetBeans will still connect to our project on github.
Any suggestions to what might help?
If you don't need to keep track of anything in the Netbeans folder anymore, then you can just erase the .git folder which keeps all the git related data (you will lose everything that hasn't been pushed to github repo as well). The .git directory is hidden, procedure to make it visible (/display & erase it) depends on the OS you are using.
If you want to keep using git, you can add the folders you don't want to have in github repo into .gitignore file.

branching svn remote folders

I have a Java project managed in SVN. This project has a remote folder - say - bin. When I create a branch from trunk, svn cp command is not copying this remote folder, but instead, it maintains the link back to the trunk. So, if somebody makes a breaking change on this file in trunk, then it is automatically reflects in feature or release branches and causes problems.
Is there a way to force SVN to copy this remote folder and all the contents under it? Or is there any other feature in SVN that lets me do this?

How to use TortoiseSVN together with Eclipse

I want to use TortoiseSVN together with Eclipse.
For now I just want to try it out.
So I use a local folder as repository.
I have installed TortoiseSVN 1.7.13.
I created a folder called 'REPOSITORY' and chose 'Create repository here' from
the context menu.
As other websites told, I installed Subclipse 1.8.22 in Eclipse.
I use the SVNKit1.7.9 as client or connector (Whatever it is called).
I had already some projects in eclipse's workspace.
From the context menu I chose 'Team->Share Project'.
That is what other websites told to do.
It did show the normal commit dialog and so on.
The projects are marked as commited but the folder 'REPOSITORY'
is still small in size.
It seems, that the projects where not copied or moved to the repository.
At work we have a server based SVN. I just want to have something like that at home.
Did I miss something?
Isn't it the purpose of the SVN repository to hold a copy of the projects?
So the commited projects should be inside the REPOSITORY, right?
Greetings
Mike
Apparently, you have to manually import the project in Eclipse into the repository created with TortoiseSVN before actually committing to it.
This other page might help you. It gives a very detailed walkthrough of how to set up exactly the kind of local system you want. In essence:
In Eclipse, delete the project but not its contents (Delete project contents on disk unchecked). This will leave the project's folder under your workspace location untouched.
Outside Eclipse, import the project folder into the repository previously created with TortoiseSVN (Right click on folder > TortoiseSVN > Import and select the URL of the repository). Once imported, you may wish to delete the project folder.
Back in Eclipse, checkout the project from TortoiseSVN's repository (e.g. Right click on Package Explorer > Import.. > SVN > Projects from SVN).
Hope that helps.
If your project's folder structure and package structure are the same, you can use Eclipse Subversive. It's just a plugin for eclipse and provides all features of TortoiseSVN

Checking in an Eclipse project into SVN

I want to checkin a Dynamic Web Project I created in eclipse into svn. Can someone tell me which files I have to check in and which one I should not? The idea is to be able to check out the project using the New Project Wizard so that I can create the Dynamic Web Project again. More specifically here are the files/directories I have in the project --
src
WebContent
build
dist
build.xml
.project
.classpath
.settings/
The build directory is not supposed to checked in obviously. What about the other ones?
I am guessing all the . files should not be checked in either. Can some one verify this?
What is this dist directory and the .settings directory?
Also where does eclipse store the Server information (tomcat)? I don't want to check it in either.
EDIT:
I initially checked in all of the above except the build directory of course. When I checked out the project from inside Eclipse it did not prompt me to create a new project since the .project is there but Eclipse was creating a JavaEE project or something instead of the Dynamic Web Project. Did anyone else run into this behavior?
** EDIT 2 **
Found it! Turns out I should not check in the following --
.project
.settings/
.classpath
Once these 3 are removed the New project Wizard works as expected and everything is fine.
If you check in .classpath/.project/.settings you make your project Eclipse-specific. What about developers who work with Netbeans or IntelliJ? IMO it is cleaner to keep your project IDE-independent and easy to set up.
I usually go for a Maven build. The pom.xml specifies all the required dependencies and mvn eclipse:eclipse generates the .classpath/.project files for you.
The .settings directory contains local settings (like which Java version you want to use). IMO it is not useful to check this in. You can enforce Java version compliance via the Maven2 pom.
Finally, for your next project, my protip is to svn-ignore the files or directories you don't want in SVN before your first commit. In a Maven2 setup that would be .settings .classpath .project target (the default output directory of Maven2) and any other generated stuff (log files, gfembed directories, etc). In your case you would ignore build and dist instead of target.
You can svn-ignore files or directories with RIGHT_MOUSE->Team->'Add to svn:ignore' (I use the Subclipse plugin). Ignore instructions are stored as svn-properties on the parent directory. The properties on a directory can be viewed by RIGHT_MOUSE->Team->Show properties. You can also edit the properties directly there by clicking on the value field. Make sure there is an end of line after each property.
Now that you have already committed and then removed these files, ignoring is not going to work anymore in my experience. Somehow I have never managed to successfully ignore generated files which have ever been checked into the SVN repository; they are like zombies, always coming back from the dead. Maybe by deleting their entries physically in the SVN repo this can be achieved, but I've never done it.
In our case, we have checked in all you mentioned in the list except, .settings/.
With .classpath and .project checked in, users can quickly check out the project and fire up Eclipse on a new computer and just start working on it; the alternative being to configure the project manually and adding in all the jar dependencies painstakingly (if you use ant). Many open source projects do this.
Read this, there are some really good points to ponder about.
Good Question... Many of us are in a dilemma on whether we want to check in IDE related files or not. I normally go for checking in .classpath for eclipse and I use eclipse variables to make sure that team needs to just change the variable value and it works. We also check in .project so that team need not to create new project in their workspace.
I would omit the .project, .settings/, dist, and build.
The .classpath can be left in if you use variables instead of hardcoded paths. This is useful so you don't have to rebuild your classpath every time you check out the project.

How do I start a new project in Eclipse and Subversion

A newbie question (I haven't really created new projects in Eclipse yet): I have a machine running Linux with a fresh install of Eclipse 3.5.2. I want to create a new Java project in an existing subversion repository (which already contains some unrelated stuff). So after running Eclipse I get this dialog to specify workspace. What is the best practise here? Should it be in subversion? Then when I created a random one, when I add a project it goes into the workspace. So if my workspace is not in subversion, where and how should I get these projects there?
Background: probably I will work on my own on this project, however I have 2 PC's which I want to be able to use interchangeably.
What I usually do is put the workspace out of the way in ~/.workspace (invisible directory). Then I create new projects outside of that workspace, in the Subversion checkout directory.
You can create a project outside the workspace as follows:
Create a directory in your Subversion repository. Your project will live in this directory.
In Eclipse, click File; New; Project.
Choose the desired project type; click Next.
Instead of "Create new project in workspace" (the default), select "Create project from existing source". The name is misleading: the source does not have to exist, just the directory!
Click Browse and select the directory that you just created.
Eclipse will create a .project file and other support files in the directory you specified. Simply add all these files to Subversion, and you're all set.
Your workspace is the folder where eclipse will place all of your projects.
Basically, once you've linked Eclipse with a SVN repository, retrieving a SVN project will send him to the workspace, thus allowing you to work on it. Once you've made the changes, you can right click on your project in the project bar (on the left, by default) and chose ->team/subversion (depending on the eclipse version) -> commit.
If you want to send a project into your subversion, you create a new project inside your workspace. Then, you right click on the project in your project bar and do the same thing.
let's say that your workspace dir is /home/grzenio/workspace and your project name is project
first of all, go to to /home/grzenio/workspace, then checkout the source code, so the code will be at /home/grzenio/workspace/project.
Open eclipse, and create a new project from the folder selecting "Create project from existing source". Select /home/grzenio/workspace/project
Voilá!

Categories