martoe / gradle-svntools-plugin

Gradle plugin that provides various SVN-related tasks
MIT License
33 stars 17 forks source link

Error when trying to assign a revision number #45

Open edimusrex opened 6 years ago

edimusrex commented 6 years ago

I am using the SvnUpdate task and am trying to pass an optional revision number to the task via the command line. Upon execution of the task, if a parameter is passed, I get the following error

A problem occurred evaluating root project 'XBRLReports'. Cannot cast object '12345' with class 'java.lang.String' to class 'java.lang.Long'

My task is written like so

task updateSource(type: SvnUpdate){
    username = svn_username
    password = svn_password

    if ( project.hasProperty("rev") ) {
        revision = rev
        println "Revision --- $rev"
    }
    doLast{
        println "Revision --- " + revision        
    }
}

And am passing the parameter as so

gradlew updateSource -Prev=12345

When no parameter is passed printing out the revision reports it as null.

edimusrex commented 6 years ago

I solved it by adding the following

revision = rev.toLong()
martoe commented 6 years ago

Yes, it's kind of ugly that the revision only accepts a number, it really should also accept strings. I will improve this