Creating a Maven project and adding it to Subversion

Brand New Standalone Project

  • Using the command line, enter the following in the root of your eclipse workspace
    mvn archetype:create -DgroupId=[packageName] -DartifactId=[projectName]
  • Go into the new directory with your projectName and setup your project with
    mvn eclipse:eclipse -DdownloadSources
  • Import your project into eclipse
  • Right click the project (Team->Share Project)
  • Select SVN
  • Select your SVN repository
  • Select “Use multiple…” under Project Repository Layout and enter your desired project location
  • Don’t commit!
  • Add target, .settings, .classpath, .project to svn ignore (i.e. select them, right click, Team->Add to svn:ignore)
  • Commit

This gives you a basic maven project in eclipse and subversion. For integration with Hudson, some nodes should be added to the pom.xml

  • parent
  • distributionManagement
  • scm

It’s probably easiest to take existing examples of the nodes from other project pom.xml’s and add them in with the appropriate tweaks.

Project Under an Existing Project

  • Using the command line, enter the following in the root of the parent project
    mvn archetype:create -DgroupId=[packageName] -DartifactId=[projectName]
  • Add the project to subversion
    svn add 'projectName'
    svn commit [projectName] pom.xml
  • Go into the parent project root and setup your project with
    mvn eclipse:eclipse -DdownloadSources
  • Import your project into eclipse
  • Add target, .settings, .classpath, .project to svn ignore
  • Commit

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply