buildnumber plugin problem: Class cast exception when doUpdate is true
----------------------------------------------------------------------

                 Key: MOJO-1404
                 URL: http://jira.codehaus.org/browse/MOJO-1404
             Project: Mojo
          Issue Type: Bug
          Components: buildnumber
    Affects Versions: buildnumber-maven-plugin-1.0-beta-3
         Environment: Maven 2.0.9 on either Windows or Mac OSX
            Reporter: Pat Podenski


For a simple Maven project when the build number plugin is configured so that 
doUpdate is true and the javasvn provider is specified, the build fails with a 
class cast exception.

The configuration for build number plugin is as follows:

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>1.0-beta-3</version>
        <dependencies>
                <dependency>
                        <groupId>com.sun.jna</groupId>
                        <artifactId>jna</artifactId>
                        <version>3.0.1</version>
                </dependency>
        </dependencies>
        <executions>
                <execution>
                        <phase>validate</phase>
                        <goals>
                                <goal>create</goal>
                        </goals>
                </execution>
        </executions>
        <configuration>
                <doCheck>true</doCheck>
                <doUpdate>true</doUpdate>
                <providerImplementations>
                        <svn>javasvn</svn>
                </providerImplementations>
        </configuration>
</plugin>

This is the class cast exception that results when doUpdate is true:

[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] org.apache.maven.scm.command.update.UpdateScmResult
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.ClassCastException: 
org.apache.maven.scm.command.update.UpdateScmResult
        at org.codehaus.mojo.build.CreateMojo.update(CreateMojo.java:528)
        at org.codehaus.mojo.build.CreateMojo.execute(CreateMojo.java:398)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
        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:585)
        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)
[INFO] ------------------------------------------------------------------------

If I set doUpdate to false, the build succeeds and the Subversion revision 
number is correctly placed in jar manifest file (using jar plugin).

I took a look at the source code for the build number plugin and I didn't see 
how the UpdateScmResult can get instantiated as a UpdateScmResultWithRevision. 
This would of course be essential if the class cast (on line 528) is to succeed 
in the following lines of code (526 - 531) from the CreateMojo:

            if ( scmProvider instanceof AbstractSvnScmProvider )
            {
                String revision = ( (UpdateScmResultWithRevision) result 
).getRevision();
                getLog().info( "Got a revision during update: " + revision );
                this.revision = revision;
            }



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
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


Reply via email to