Apparently, it was never supported. The project site says only SVN is supported.
To keep your build reproducible, it is always recommended to explicitly set the 
version of the plugins you use.

Cheers,
Tomas




________________________________
From: David Lewis <[email protected]>
To: [email protected]
Sent: Tue, November 24, 2009 2:59:41 PM
Subject: [mojo-user] ClassCastException using buildnumber-maven-plugin 
1.0-beta-4

I've been using the buildnumber-maven-plugin to include the build date into my 
META_INF/MANIFEST.MF file.  I wish I could include an SCM revision number, but 
unfortunately my company uses Perforce instead of SVN :(.  Including the build 
date has been a nice alternative, though.  It's been working great until this 
morning when Maven grabbed the 1.0-beta-4 version of the 
buildnumber-maven-plugin.  Now I get the following exception when trying to 
build:

[INFO] [buildnumber:create {execution: default}]
[INFO] Storing buildNumber: 2009-11-24 10:31:22 MST at timestamp: 1259083882019
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot get the branch information from the scm repository :
Exception while executing SCM command.

org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository 
cannot be cast to 
org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository
[INFO] ------------------------------------------------------------------------

Is it no longer valid to use the buildnumber-maven-plugin without using SVN?  
It's been really useful for storing the build date, but is this something that 
is no longer supported?  I didn't see anything in the docs that would suggest 
that this is no longer supported.  I can force my build to stay on 1.0-beta-3 
and continue working, but I'm curious if this is a bug in 1.0-beta-4 or if it's 
not allowed anymore.

My plugin configuration looks like this:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <format>{0,date,yyyy-MM-dd HH:mm:ss z}</format>
                    <items>
                        <item>timestamp</item>
                    </items>
                    <doCheck>false</doCheck>
                    <doUpdate>false</doUpdate>
                </configuration>
            </plugin>

The full exception is this:

[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Cannot get the branch 
information from the scm repository : 
Exception while executing SCM command.
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
 
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:1205)
    
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:1038)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:643)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
    
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
      
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at 
org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot get the 
branch information from the scm repository :
Exception while executing SCM command.
        at org.codehaus.mojo.build.CreateMojo.getScmBranch(CreateMojo.java:606)
        at org.codehaus.mojo.build.CreateMojo.execute(CreateMojo.java:452)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 21 more
Caused by: org.apache.maven.scm.ScmException: Exception while executing SCM 
command.
        at 
org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:63)
        at 
org.apache.maven.scm.provider.svn.AbstractSvnScmProvider.executeCommand(AbstractSvnScmProvider.java:354)
        at 
org.apache.maven.scm.provider.svn.AbstractSvnScmProvider.info(AbstractSvnScmProvider.java:375)
        at org.codehaus.mojo.build.CreateMojo.info(CreateMojo.java:694)
        at org.codehaus.mojo.build.CreateMojo.getScmBranch(CreateMojo.java:594)
        ... 24 more
Caused by: java.lang.ClassCastException: 
org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository 
cannot be cast to 
org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository
        at 
org.apache.maven.scm.provider.svn.svnexe.command.info.SvnInfoCommand.executeCommand(SvnInfoCommand.java:54)
     
        at 
org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)
        ... 28 more

Thanks in advance for any help!
--David 


      

Reply via email to