Cannot read revision version when git has been configured with a pretty format
option
-------------------------------------------------------------------------------------
Key: MBUILDNUM-77
URL: https://jira.codehaus.org/browse/MBUILDNUM-77
Project: Mojo Build Number Maven Plugin
Issue Type: Bug
Affects Versions: buildnumber-maven-plugin-1.0
Environment: maven 3.0.3, git 1.7.7.2
Reporter: Thomas Queste
The plugin fails when reading the revision number from Git when Git is
configured with a format.pretty option.
*Stacktrace*
Here, Git has a format.pretty option, and the plugin fails:
{code}
[ERROR] Failed to execute goal
org.codehaus.mojo:buildnumber-maven-plugin:1.0:create (default) on project
iw-project: Execution default of goal
org.codehaus.mojo:buildnumber-maven-plugin:1.0:create failed: Index: 0, Size: 0
-> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal
org.codehaus.mojo:buildnumber-maven-plugin:1.0:create (default) on project
iw-project: Execution default of goal
org.codehaus.mojo:buildnumber-maven-plugin:1.0:create failed: Index: 0, Size: 0
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default
of goal org.codehaus.mojo:buildnumber-maven-plugin:1.0:create failed: Index: 0,
Size: 0
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.codehaus.mojo.build.CreateMojo.getScmBranch(CreateMojo.java:637)
at org.codehaus.mojo.build.CreateMojo.execute(CreateMojo.java:464)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
... 20 more
{code}
*Problematic git configuration*
{code}
$ git config -l | grep format
format.pretty=%C(yellow)%h%Creset %s %C(red)(%an, %cr)%Creset
{code}
*Result of 'git show' with this format.pretty option*
This output is not parseable by the buildnumber plugin.
{code}
[DEBUG] consume line 4689188 Factory: remove unused funtions (tqueste, 2 days
ago)
{code}
*Workaround*
Remove the format.pretty configuration option. The plugin runs successfully.
*Solution*
Either the plugin disable the format.pretty option when running, or it stopped
with a warning ("'format.pretty' option used. Cannot continue").
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email