maven-scm-provider-jgit

This scm provider implementation allows the usage of git with the release and scm plugin without having to install a native git client. This implementation can use both username and password, or public/private keys to authenticate the requests to a remote repository like GitHub. At the moment, public/private keys are only supported for SSH access.

Configuration

Usage with the maven-release-plugin

		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-release-plugin</artifactId>
			<version>2.3</version>
			<configuration>
				<providerImplementations>
					<git>jgit</git>
				</providerImplementations>
			</configuration>
			<dependencies>
				<dependency>
					<groupId>org.apache.maven.scm</groupId>
					<artifactId>maven-scm-provider-jgit</artifactId>
                    <version>2.0.0</version>
				</dependency>
			</dependencies>
		</plugin>

Usage with the maven-scm-plugin

		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-scm-plugin</artifactId>
            <version>2.0.0</version>
			<configuration>
				<providerImplementations>
					<git>jgit</git>
				</providerImplementations>
			</configuration>
			<dependencies>
				<dependency>
					<groupId>org.apache.maven.scm</groupId>
					<artifactId>maven-scm-provider-jgit</artifactId>
                    <version>2.0.0</version>
				</dependency>
			</dependencies>
		</plugin>

Public/private key configuration in settings.xml - for use with ssh URLs like ssh://git@github.com/apache/maven-scm

		<servers>
			<server>
			    <id>git@github.com</id>
			    <privateKey>path/to/private/key</privateKey>
			    <passphrase>private key passphrase</passphrase>
			</server>
		<server>

Examples


changelog

mvn org.apache.maven.plugins:maven-scm-plugin:2.0.0:changelog

release

mvn release:prepare release:perform -Dresume=false -Dusername=XXX -Dpassword=XXX

Committer / Author


The jgit provider per default uses the information of the “user” section in the .gitconfig. If you explicitly configure a user there, this user will be used as author and committer. If you don't define a user in the .gitconfig, then the user passed as “username” with the maven execution is used. The email per default will be ‘username’@hostname. If you don't like the hostname to be used as the domain. you can configure a default domain in the .gitconfig as follows:

git config --global maven-scm.maildomain mycomp.com	

You can also enforce the usage of the “username” for the author and committer (omit the default in the .gitconfig):

git config --global maven-scm.forceUsername true

Features

this is a brief list of the supported maven-scm-provider-jgit's integration status with regard to some core maven plugins

maven-scm-plugin

goal implemented?
scm:list yes
scm:tag yes
scm:bootstrap no
scm:export no
scm:update no
scm:status yes
scm:edit no
scm:changelog yes
scm:add yes
scm:unedit no
scm:validate yes
scm:branch yes
scm:checkin yes
scm:checkout yes
scm:diff yes
scm:blame yes
scm:remoteinfo yes

maven-release-plugin

goal implemented?
release:clean yes
release:prepare yes
release:rollback no
release:perform yes
release:stage no
release:branch yes