git - How do i successfully use the Maven release plug-in with GitHub (or GitHub enterprise) when using a CI tool like Hudson/Jenkins -
how use maven release plug-in github (or github enterprise) when using ci tool hudson/jenkins
problems encountered are
- maven not commit if pom.xml in sub folder rather top level. due subsequent builds fail tag name exists.
- in spite of setting public key authentication between source server runs ci job, git push fails 1 of following errors
- public key authentication failed
- unknown service git
there multiple things need correct work.
for sub-folder commit of pom.xml work, bug resolved in maven release plug-in 2.5.1. latest dependencies. below section shows pom.xml
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-release-plugin</artifactid> <version>2.5.1</version> <dependencies> <dependency> <groupid>org.apache.maven.scm</groupid> <artifactid>maven-scm-provider-gitexe</artifactid> <version>1.9.2</version> </dependency> </dependencies> <configuration> <checkmodificationexcludes> <checkmodificationexclude>pom.xml</checkmodificationexclude> </checkmodificationexcludes> </configuration> </plugin>
correctly configure scm section in pom.xml. public key authentication work, use ssh protocol. https protocol, user/password needed, answer not cover that. should possible providing user/pwd in maven settings.xml in servers section.
<scm> <developerconnection>scm:git:ssh://github.com/org/repo.git</developerconnection> <url>https://github.com/org/repo</url> <tag>head</tag> </scm>
create user called git in source server. if run other user, developerconnection url need have git@github.com in stead of github.com. maven try put git:****** in git push command , fails service unknown. if use other user ssh github, reject public key authentication failed.
using git user, generate ssh keys , configure following simple steps below
edit hudson/jenkins job below
- under source code management section, provide url of git repo. might need put git protocol ci installs not support https.
- mention branch in branches build (e.g. development)
- click advanced , put same branch name in section "checkout/merge local branch (optional)"
run job maven goals clean compile release:prepare , release:perform. should work.
Comments
Post a Comment