Wednesday, November 09, 2011

Maven + Subversion Enabled Eclipse Java Project

Updated - Apr 2013
What I want for my Eclipse projects is to be Java projects, allow content revisions with Subversion and be managed by Maven.

This is what I need to do.

Eclipse version: Eclipse Juno
Subversion plugin: Subversive
Maven plugin: m2eclipse (m2e)

Support for Subversion and Maven is now integrated into Eclipse.
  1. Choose Help --> Install new software --> Work with: Juno - http://download.eclipse.org/releases/juno.
  2. Expand collaboration and check the m2eclipse and Subversive packages. Install all required components.
  3.  Add the Polarion update site: http://community.polarion.com/projects/subversive/download/eclipse/2.0/juno-site/ (see step 1 for details) and install the Subversive SVN Connectors and a connector of your choice (I use SVNKit 1.7.4)
  1. Create a new project (Checkout Maven projects from SCM). Choose svn as SCM URL and type the URL. If svn does not appear in the list, check the global configuration under Window --> Preferences --> Team --> SVN --> SVN Connector. The connector you just installed must appear on that list.
  2. Once the project has been created, you might have a Java-Maven project only. If that's the case, to connect it to the SVN repository, right click on the project's name, choose Team --> Share --> SVN and follow the instructions to conncet your project to the SVN source.
Now you have a Java project checked out from a Subversion repository which uses a Maven repository to manage its library dependencies.
You can further configure Maven under Window --> Preferences --> Maven. In particular you can add an external Maven installation and change the location of the repository which defaults to the user's personal repository and not the global one.