First create a project using maven2 (maven in 5 minutes):
mvn archetype:create -DgroupId=com.name.test -DartifactId=scmtest
Now edit the pom.xml file:
To add the following line underneath the <url> tag (mvn scm plugin):
Don't execute any mvn release goals yet because we still need to configure subversion. Let's start with creating the repo. Like you may have seen in the previous url to the repo I'm putting everything locally. Just for testing. When you have a server running somewhere you probably also know how to manage it (svn repo creation and config).
svnadmin create c:/svn-repo/scmtest
I'm not completely sure about the best way to get the standard svn repo structure in there? What I did is to create a /trunk, /branches and /tag folder and copying my mvn project into there. And then I import all of it in once.
Next you can import your project for the first time:
svn import file:///c:/svn-repo/scmtest -m "initial import"
Now check this out somewhere else first so you van continue working on an svn enabled project which is needed. You note the difference in the svn repo url? This time I only need what's in the trunk folder. Our actual project, not the tags and branches.
svn checkout file:///c:/svn-repo/scmtest/trunk c:/projects/scmtest-svn
Please note that for the next commands you need to be in the folder you just checked out. If you copied the command before this will be c:/projects/scmtest-svn/ so go there first.
And then add some files to the ignore list. The target directory and eclipse files for instance. This command requires the system variable SVN_EDITOR to be set. This could be set to the edit command which is the default text based editor of your windows system.
svn propedit svn:ignore .
Note that the dot (.) pointing to the current directory is required, don't forget it. That's the whole point (:-)) of being in the right directory.
So this command will popup the svn editor you set. And there add the following lines to this file:
And don't forget to save this file. So we can continue, we're almost there. In fact the svn repo is now up and running, we have the most recent version checked out, ... so now we can prepare our first release.
In real life you would only do this after some development, this time you can try out immediately by executing the following maven plugin:goal:
Next you'll be prompted for the release numbers. You can use defaults by hitting enter each time.
If all goes well you're now working on a new SNAPSHOT version. You can verify this by looking at the pom file. The next step, to really get your new release in the mvn repo execute:
And if you had some problems you can try:
Some more release goals.
To get the project into eclipse you can always run the following maven plugin:goal:
Note how we already added the now generated eclipse files to the ignore list.