Tuesday, 15 January 2013

java - Suppressing GPG signing for Maven-based continous integration builds (Travis CI) -



java - Suppressing GPG signing for Maven-based continous integration builds (Travis CI) -

i'm using travis-ci provide continuous integration builds few java open source projects i'm working on.

normally works smoothly, have problem when pom specifies gpg signing, e.g.

<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-gpg-plugin</artifactid> <version>1.4</version> <executions> <execution> <id>sign-artifacts</id> <phase>verify</phase> <goals> <goal>sign</goal> </goals> </execution> </executions> </plugin>

this causes travis build fail - apparently because not have passphrase available while running mvn install. see this build example.

what best way configure maven and/or travis skip gpg signing ci test builds, still perform gpg signing when proper release build?

you need create profile & create sure run when release build.

remove current plugin, , add together in profile this:

<profiles> <profile> <id>release-sign-artifacts</id> <activation> <property> <name>performrelease</name> <value>true</value> </property> </activation> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-gpg-plugin</artifactid> <version>1.4</version> <executions> <execution> <id>sign-artifacts</id> <phase>verify</phase> <goals> <goal>sign</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles>

and when need release, add together property mvn command:

mvn -dperformrelease=true ...

java maven continuous-integration gnupg travis-ci

No comments:

Post a Comment