Monday, April 26, 2010

Bootstrapping Buckminster & Subclipse with P2 Director

On my current project at work, we are changing from using PDE-Build to create our Eclipse RCP product to using Buckminster. I found a very valuable tutorial to get me started, but I kept getting exceptions like these:


ERROR: Could not instantiate provider org.tigris.subversion.subclipse.core.svnnature for project com.foo.
org.eclipse.team.core.TeamException: Could not instantiate provider org.tigris.subversion.subclipse.core.svnnature for project com.asolutions.soaf.validation.ws.documentation.test.
at org.eclipse.team.core.RepositoryProvider.mapNewProvider(RepositoryProvider.java:165)
at org.eclipse.team.core.RepositoryProvider.mapExistingProvider(RepositoryProvider.java:235)
at org.eclipse.team.core.RepositoryProvider.getProvider(RepositoryProvider.java:507)
at org.eclipse.team.internal.core.TeamHookDispatcher.getProvider(TeamHookDispatcher.java:97)
at org.eclipse.team.internal.core.TeamHookDispatcher.getRuleFactory(TeamHookDispatcher.java:105)
at org.eclipse.core.internal.resources.Rules.factoryFor(Rules.java:92)
at org.eclipse.core.internal.resources.Rules.modifyRule(Rules.java:144)
at org.eclipse.core.internal.resources.Project.touch(Project.java:1191)
at org.eclipse.jdt.internal.core.SetContainerOperation.executeOperation(SetContainerOperation.java:115)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:793)
at org.eclipse.jdt.core.JavaCore.setClasspathContainer(JavaCore.java:4842)
at org.eclipse.pde.internal.core.PluginModelManager$UpdateClasspathsJob.run(PluginModelManager.java:57)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)



The solution is to install subclipse, but doing so within Buckminster is painful because you can only specify a single repository location from the command line. Subclipse has a lot of dependencies that already exist in a default eclipse install, but are missing from buckminster-headless, so I needed to specify multiple repositories.

p2 director to the rescue!

In the tutorial, there is a section on bootstrapping buckminster with p2 director. The tutorial loads just the buckminster command-line application from p2 and then uses the buckminster command-line application to load more features into itself. This is convenient when all features and dependencies exist within a single repository, but as I said above, this is not my situation.

Assuming you are using bash and have p2 director installed, here is the command:


director/director\
-r http://download.eclipse.org/tools/buckminster/headless-3.6,http://download.eclipse.org/releases/helios/,http://subclipse.tigris.org/update_1.6.x\
-d `pwd`/buckminster-headless-3.6/\
-p Buckminster\
-i org.eclipse.buckminster.cmdline.product\
-i org.eclipse.buckminster.core.headless.feature.feature.group\
-i org.eclipse.buckminster.pde.headless.feature.feature.group\
-i org.tigris.subversion.subclipse.feature.group\
-i org.tigris.subversion.clientadapter.svnkit.feature.feature.group