You remember my first post on SCM? Well finally I had some time to get this running. Let me tell you how.
First create a project using maven2 (maven in 5 minutes):
c:
cd projects
mvn archetype:create -DgroupId=com.name.test -DartifactId=scmtest
Now edit the pom.xml file:
cd scmtest
edit pom.xml
To add the following line underneath the tag (mvn scm plugin):
http://maven.apache.org
scm:svn:file:///c:/svn-repo/scmtest/trunk
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
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
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 .
So this command will popup the svn editor you set. And there add the following lines to this file:
target
.project
.classpath
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:
mvn release:prepare
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:
mvn release:perform
And if you had some problems you can try:
mvn release:rollback
To get the project into eclipse you can always run the following maven plugin:goal:
mvn eclipse:eclipse
Note how we already added the now generated eclipse files to the ignore list.