Extension Points and API

Skip to end of metadata
Go to start of metadata

How to use extension points page explains how to create new Eclipse plugin to use extension points below.

Custom pages in Maven POM editor (since 0.9.7)

The Maven POM editor can be extended by adding custom pages using the following extension point:

<extension point="org.maven.ide.eclipse.editor.pageFactories">
  <factory class="org.foo.FooPageFactory"/>

The org.foo.FooPageFactory class should extend MavenPomEditorPageFactory and could look something like this:

public class FooPageFactory extends MavenPomEditorPageFactory {
  public void addPages(MavenPomEditor pomEditor) {
    if(shouldAddPage()) {
      try {
        pomEditor.addPage(new FooPage(pomEditor));
      } catch(CoreException ex) {

In the above example, FooPage class should extend org.eclipse.ui.forms.editor.FormPage and it could use MavenPomEditor API to get information about Maven project opened in the editor and other m2eclipse API to get information from the Eclipse workspace. For example:

MavenProject p = pomEditor.readMavenProject(false, null);
MavenProjectManager projectManager = MavenPlugin.getDefault().getMavenProjectManager();
IMavenProjectFacade facade = projectManager.getMavenProject(p.getGroupId(),
     p.getArtifactId(), p.getVersion());
if(facade != null) {
  IProject project = facade.getProject();

Custom actions in Maven popup menu (since 0.9.6)

Custom actions can be contributed using org.maven.ide.eclipse.m2menu extension point. For example:

<extension point="org.maven.ide.eclipse.m2menu">
  <factory class="org.maven.ide.eclipse.jdt.internal.ui.MavenJdtMenuCreator"/>

The MavenJdtMenuCreator should implement org.maven.ide.eclipse.actions.AbstractMavenMenuCreator and could look like this:

public class FooMenuCreator extends AbstractMavenMenuCreator {

  public void createMenu(IMenuManager mgr) {
    int selectionType = SelectionUtil.getSelectionType(selection);
    if(selectionType == SelectionUtil.UNSUPPORTED) {

    if(selectionType == SelectionUtil.PROJECT_WITH_NATURE) {
      mgr.appendToGroup(OPEN, getAction(new FooAction(), FooAction.ID, "Foo"));

In the above example FooAction implements org.eclipse.ui.IObjectActionDelegate. To track selection, FooAction.selectionChanged() method is being called on selection change.

Custom templates in POM XML editor (since 0.9.4)

Custom templates can be contributed using org.eclipse.ui.editors.templates extension point. For example:

<extension  point="org.eclipse.ui.editors.templates">
  <template id="org.maven.ide.eclipse.editor.xml.templates.plugin.javac"
       name="javac plugin" 
       description="Java complier plugin configuration">

The following context types are defined:

  • org.maven.ide.eclipse.editor.xml.templates.contextType.project
  • org.maven.ide.eclipse.editor.xml.templates.contextType.parent
  • org.maven.ide.eclipse.editor.xml.templates.contextType.properties
  • org.maven.ide.eclipse.editor.xml.templates.contextType.properties
  • org.maven.ide.eclipse.editor.xml.templates.contextType.dependencies
  • org.maven.ide.eclipse.editor.xml.templates.contextType.exclusions
  • org.maven.ide.eclipse.editor.xml.templates.contextType.plugins
  • org.maven.ide.eclipse.editor.xml.templates.contextType.repositories
  • org.maven.ide.eclipse.editor.xml.templates.contextType.groupId
  • org.maven.ide.eclipse.editor.xml.templates.contextType.artifactId
  • org.maven.ide.eclipse.editor.xml.templates.contextType.version
  • org.maven.ide.eclipse.editor.xml.templates.contextType.classifier
  • org.maven.ide.eclipse.editor.xml.templates.contextType.type
  • org.maven.ide.eclipse.editor.xml.templates.contextType.packaging

Project configuration (since 0.9.4)

Pre-configured Maven repository indexes (since 0.9)

See Nexus Indexer

Maven Archetype Catalogs (since 0.9.3)

Maven Archetype Catalogs allow to narrow package set of Maven archetypes that can be selected in the
"New Maven Project" wizard. Those catalogs can be also packaged within eclipse plugins using org.maven.ide.eclipse.archetypeCatalogs extension point. The following declaration defines two Archetype catalogs, first one is packaged withing Eclipse plugin and second is pointing to remote HTTP location:

<extension point="org.maven.ide.eclipse.archetypeCatalogs">
  <local  description="Test Packaged Catalog"
  <remote description="Maven Central Catalog"

SCM Integration (since 0.9.2)

SCM handlers are used to check out Maven projects from Materialize Maven Project and Checkout Maven Project wizards.

Several SCM handlers had been implemented:

To add custom SCM handler class you can extend org.maven.ide.eclipse.scm.ScmHandler and contributed using the following extension point:

<extension point="org.maven.ide.eclipse.scmHandlers">
  <handler type="svn" priority="10"

To support provider specific repository and history browsing provider can contribute SCM handler UI that should extend org.maven.ide.eclipse.scm.ScmHandlerUi and contributed using the following extension point:

<extension point="org.maven.ide.eclipse.scmHandlersUi">
   <handlerUi type="svn" 

To allow "Checkout as Maven project..." action recognize custom models and enable this action in custom views (such as Subclipse's Repositories view) and object popup menu contributions you need to provide an IAdaptable for org.maven.ide.eclipse.scm.ScmUrl class. There is two options:

  • make your objects implement IAdaptable interface and provide corresponding implementation of getAdapter() method
  • contribute a runtime adapter factory and adapt your objects to org.maven.ide.eclipse.scm.ScmUrl

For example, adapter factory extension point for Subclipse to adapt its ISVNRemoteFolder look like this:

<extension point="org.eclipse.core.runtime.adapters">
   <factory adaptableType="org.tigris.subversion.subclipse.core.ISVNRemoteFolder"
      <adapter type="org.maven.ide.eclipse.scm.ScmUrl"/>

Then SubclipseUrlAdapterFactory can be implemented like this:

public class SubclipseUrlAdapterFactory implements IAdapterFactory {
  private static final Class[] ADAPTER_TYPES = new Class[] { ScmUrl.class };
  public Class[] getAdapterList() {
    return ADAPTER_TYPES;
  public Object getAdapter(Object adaptable, Class adapterType) {
    if(ScmUrl.class.equals(adapterType)) {
      if(adaptable instanceof ISVNRemoteFolder) {
        SVNUrl svnUrl = ((ISVNRemoteFolder) adaptable).getUrl();

        String scmUrl = SubclipseHandler.SCM_SVN_PREFIX + svnUrl.toString();
        SVNUrl parent = svnUrl.getParent();
        String scmParentUrl = null;
        if(parent!=null) {
          scmParentUrl = SubclipseHandler.SCM_SVN_PREFIX + parent.toString();
        return new ScmUrl(scmUrl, scmParentUrl);
    return null;


m2eclipse m2eclipse Delete
maven maven Delete
eclipse eclipse Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.