Hi all,

I have a problem with maven-buildnumber-plugin that puts the build number into the manifest.

The plugin is configured from profile "svn-buildnumber" (yes, the name seems misleading for a git project) which is automatically activated as we do not define any "buildNumber.skip" property. The configuration creates a build number at "generate-resources"
phase during the maven build. This would be perfect for me.

The plugin should work with git in the current version, and indeed it attempts to retrieve the last commit number. However, it doesn't succeed here. If I run the appropriate phase
with debug on, here is what I get:

luc@marislae:~/sources/eclipse/commons-math$ mvn -X generate-resources
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.8.0_20-internal-fastdebug, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-4-amd64", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml

   ... snip ...

[DEBUG] Configuring mojo org.codehaus.mojo:buildnumber-maven-plugin:1.2:create from plugin realm ClassRealm[plugin>org.codehaus.mojo:buildnumber-maven-plugin:1.2, parent: sun.misc.Launcher$AppClassLoader@4554617c] [DEBUG] Configuring mojo 'org.codehaus.mojo:buildnumber-maven-plugin:1.2:create' with basic configurator --> [DEBUG] (s) buildNumberPropertiesFileLocation = /home/luc/sources/eclipse/commons-math/buildNumber.properties
[DEBUG]   (f) buildNumberPropertyName = buildNumber
[DEBUG]   (s) doCheck = false
[DEBUG]   (s) doUpdate = false
[DEBUG]   (f) getRevisionOnlyOnce = false
[DEBUG] (f) project = MavenProject: org.apache.commons:commons-math3:3.4-SNAPSHOT @ /home/luc/sources/eclipse/commons-math/pom.xml [DEBUG] (f) reactorProjects = [MavenProject: org.apache.commons:commons-math3:3.4-SNAPSHOT @ /home/luc/sources/eclipse/commons-math/pom.xml] [DEBUG] (f) readUrlScm = scm:git:http://git-wip-us.apache.org/repos/asf/commons-math.git
[DEBUG]   (s) revisionOnScmFailure = ??????
[DEBUG]   (f) scmBranchPropertyName = scmBranch
[DEBUG]   (s) scmDirectory = /home/luc/sources/eclipse/commons-math
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@6622fc65
[DEBUG]   (f) timestampPropertyName = timestamp
[DEBUG] (s) urlScm = scm:git:https://git-wip-us.apache.org/repos/asf/commons-math.git
[DEBUG]   (f) useLastCommittedRevision = true
[DEBUG] -- end configuration --
[INFO] Checking for local modifications: skipped.
[INFO] Updating project files from SCM: skipped.
[INFO] Executing: /bin/sh -c cd /home/luc/sources/eclipse/commons-math && git rev-parse --verify HEAD
[INFO] Working directory: /home/luc/sources/eclipse/commons-math
[DEBUG] consume line 75872ffe9b3711683253c1d5be7ec3bb80ef1a30
[INFO] Storing buildNumber: null at timestamp: 1418733702845
[INFO] Executing: /bin/sh -c cd /home/luc/sources/eclipse/commons-math && git rev-parse --verify HEAD
[INFO] Working directory: /home/luc/sources/eclipse/commons-math
[DEBUG] consume line 75872ffe9b3711683253c1d5be7ec3bb80ef1a30
[INFO] Storing buildScmBranch: UNKNOWN


So the buildnumber plugin correctly identifies the source code management system as git, it correctly run the get rev-parse command to retrieve the value, it correctly reads the last commit SHA (which here is 75872ffe9b3711683253c1d5be7ec3bb80ef1a30), but then it fails to store it as it reports:

Storing buildNumber: null at timestamp: 1418733702845

As I understand, is would be normal to get UNKNOWN branch for git, but the commit number should be right.

As a workaround, I have set up maven-jgit-buildnumber-plugin in the [math] pom, and this worked for me. I also tried to prevent buildnumber-maven-plugin to run by setting buildNumber.skip to true, but in fact the git rev-parse command is still run (and its output is still not grabbed). I would clearly prefer to use the same plugin as the other components: buildnumber-maven-plugin, but wa not able to make it work.

Do anyone understand what happens?

best regards,
Luc

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to