Tuesday, December 10, 2013

Getting eclipse to co-operate with maven & subversion

Oh my, I didn't realize it's been over a year since my last post.  This isn't to imply at all that my past year has been without frustrations.  In fact, I have several stubs for blog posts in my evernote that I just haven't had the time to fully flesh out and put up.  I'll start with today's, since it is very self contained and I have been able to work out a few variations for documenting here.

Today's frustration has been brought to you by maven, subversion and eclipse.

I was first introduced to the notion of having to use eclipse with maven and subversion was several years ago with Eclipse Ganymede.  The sheer pain of having to configure Eclipse to play happily with maven and subversion made me very adverse to updating my Eclipse installation.  In fact, I've waited until updates to features stopped being issued and the features themselves became more or less unsupported.  Point in fact, as of Monday morning, I have been using Eclipse Helios.

Due to some quirkiness in my workspace, I finally decided to bite the bullet and upgrade to Eclipse Kepler.  I had some hiccups getting the correct incantation to have everything work well, but after I repeated the steps a few times (for documentation sake), I can actually say, it's not that painful.

So, to help myself (as well as anyone else floundering) avoid painful eclipse updates, here are the steps for the following configuration:

  • Local (my machine):
    • Eclipse Kepler Release 1 - Java EE
    • Mac OSX Mountain Lion (10.8.5)
  • Server (somewhere in the wild wild web):
    • Maven 3.0.5
    • Subversion 1.6.11
The following documentation assumes a fresh install, with no other extensions/plugins/thingamabobs installed on top of the Eclipse.  Note that in my set up, I do not touch JavaHL with a ten foot pool.  No particular reason except it causes extra confusion, pre-requisites, steps to get it to work.

Also, before we start, there are TWO different options for working with subversion.  I don't have a strong preference for either.  I'm used to Subclipse, but Subversive has prettier icons.

Without further ado, here we go.
  1. Start Eclipse
  2. Help -> Eclipse Marketplace ...
  3. Install Maven Integration
    • ~ EDIT ~
      • If you have installed the Jave EE version of Eclipse, you can skip this step.  Maven Integration is already bundled in. Continue on to step 4.
    • Type in 'Maven Integration' in the search box
    • Scroll down until you find:
      • Maven Integration for Eclipse (Juno and Newer) 1.4
      • eclipse.org, epl
    • Click 'Install'.
    • Do not finish the install yet
    • Click '< Install More'
  4. Install a Subversion solution (NB: There are two options, both are listed)
    • Type in 'Subversion' in the search box
    • Option 1: Subversive
      • Scroll down until you find:
        • Subversive - SVN Provider 1.1.1
        • eclipse.org, epl
      • Click 'Install Now'
      • Break (Go to step 5)
    • Option 2: Subclipse
      • ~ EDIT ~
        • Apparently between writing this up earlier today and now (about 6 hours), there is a new version of Subclipse available via the Marketplace.  For whatever reason, installing this new version (Subclipse 1.10.x) causes an inability to install the SCM connector.
      • Exit the Eclipse Marketplace
      • Install the solution directly:
        • Help -> Install New Software
        • Add a new software style:
          • http://subclipse.tigris.org/update_1.8.x/
      • Go to step 7.
      • Scroll down until you find:
        • Subclipse 1.8.22
        • Subclipse Project, epl
      • Click 'Install Now'
      • Break (Go to step 5)
  5. You will now see screen with a list of all of the items that will be installed for the selected solutions.  
  6. If you are using Option 1: Subversive, there are no additional steps.  All the features should be selected for the two solutions.
  7. If you are using Option 2: Subclipse, you will need to perform an additional step to avoid future headaches.

    • Expand the Subclipse folder
      • Uncheck 'Subversion JavaHL Native Library Adapter'
    • Expand the SCNKit folder
      • Ensure that 'SVNKit Client Adapter' is checked
  1. You will now be prompted to restart eclipse, restart eclipse.

  1. Welcome back! Switch to the 'Java' perspective.  
    • If you don't have the 'Java' perspective as an option, do this:
      • Window -> Open Perspective -> Other... -> Java

  1. Select the 'Package Explorer' view.
    • If you don't have the 'Package Explorer' view, do this:
      • Window -> Show View -> Other... -> Package Explorer
  2. Right click in the empty area and select 'Import'
  3. Filter the import source for 'Maven'
    • Select 'Check out Maven Projects from SCM'
    • Click 'Next >'

  1. Select the m2e Marketplace link
    • NB: This is not the same marketplace as the eclipse marketplace

  1. Scroll down until you see the section 'm2e Team providers'.
    • If you are using Option 1: Subversive (from step 4), select the option that has been highlighted in blue.
      • m2e-subversive
    • If you are using Option 2: Subclipse (from step 4), select the option that has been highlighted in pink.
      • m2e-subclipse
  2. Click 'Finish' and follow the prompts to complete installation. You will be prompted to restart eclipse again, so restart eclipse.
  3. C'est Fin!
You should now be able to check out maven projects from your svn repository.  Enjoy!

    No comments:

    Post a Comment