How to define a non Apache Maven hosted implementation?

Apache Maven supports a lot of implementations, but not all. However, with the following steps you can make Maven use this implementation for all your projects.

Prepare Maven

Make the SCM implementation available for Maven by downloading the required jars and add them to Maven. If there's a jar-with-dependencies or a shaded jar, then that's the only jar required. Otherwise check the project for all transitive dependencies.

  • Maven 3.x : Add jars to %M2_HOME%/lib/ext/
  • Maven 2.x : Add jars to %M2_HOME%/lib/

Note:Be aware that these jars now end up next to the root classloader of Maven. If you experience unexpected behavior, verify there's no class collision.

Configure settings.xml

Since it is very well possible to have multiple versions of Maven next to each other, the preferred settings.xml to adjust is the instance with the additional jars.

%M2_HOME%/conf/settings.xml

<settings>
  ...
  <profiles>
    <profile>
      <id>scm</id>
      <properties>
        <!-- this example sets the implementation for svn to javasvn -->
        <maven.scm.provider.svn.implementation>javasvn</maven.scm.provider.svn.implementation>
      </properties>
    </profile>    
  </profiles>
  
  <activeProfiles>
    <!-- activate it always or use -Pscm -->
    <activeProfile>scm</activeProfile>
  </activeProfiles>
  
</settings>

From now on when this Maven instance is used, it will always use the specified SCM provider implementation.