Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Casting exception #4

Closed
cengizkandemir opened this issue Feb 2, 2018 · 12 comments
Closed

Casting exception #4

cengizkandemir opened this issue Feb 2, 2018 · 12 comments

Comments

@cengizkandemir
Copy link

cengizkandemir commented Feb 2, 2018

I am having the following error when I use io.github.rockerhieu:versionberg:1.0.1

Cannot cast object 'null' with class 'null' to class 'int'. Try 'java.lang.Integer' instead

This doesn't seem to be the case if I compile the plugin from the source, and declare it as the dependency. Is io.github.rockerhieu:versionberg:1.0.1 the latest version?

For the record, the same gradle script runs well if I use io.github.rockerhieu:versionberg:1.0.0 and comment out the gitDir attribute.

@rockerhieu
Copy link
Owner

rockerhieu commented Feb 2, 2018

What does your gitDir look like?

@rockerhieu
Copy link
Owner

This is an example of gitDir usage:

versionberg {
    major 1
    minor 0
    patch 10
    nameTemplate '${major}.${minor}.${commitSha}.${new Date().format("ddMMyyyy")}-SNAPSHOT'
    codeTemplate '(((${major} * 100) + ${minor}) * 100) * 100000 + ${build}'
    gitDir new File("/Users/myuser/Development/Versionberg/.git")
}

@cengizkandemir
Copy link
Author

cengizkandemir commented Feb 2, 2018

gitDir "${project.projectDir.absolutePath}/.."

But this might not be the issue. Giving absolute path, e.g., "/home/user/<path-to-git-repo>" doesn't seem to solve this problem either.

As I said, compiling from sources, and giving dependency to the local jar file doesn't cause this problem. Complete Versionberg field:

versionberg {
    gitDir "${project.projectDir.absolutePath}/.."
    major 0
    minor 0
    patch 0
    nameTemplate '${major}.${minor}.${patch}.${commitCount}.${commitSha}'
    codeTemplate '(((${major} * 100) + ${minor}) * 100) * 100000 + ${build}'
}

@cengizkandemir
Copy link
Author

cengizkandemir commented Feb 2, 2018

I just realized that you are using File type. But changing it to point a file with a .git path doesn't seem to help.

Also, it appears that I was using an older local version. I just re-fetched the head and the problem exists even when I compile from the source.

Compiling with the following field produces a different error:

versionberg {
    major 0
    minor 0
    patch 0
    nameTemplate '${major}.${minor}.${patch}.${commitCount}.${commitSha}'
    codeTemplate '(((${major} * 100) + ${minor}) * 100) * 100000 + ${build}'
    gitDir new File("\<path-to-some-git-repo/.git\>")
}

Ambiguous method overloading for method java.lang.Integer#plus.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[class java.lang.Character]
[class java.lang.String]
[class java.lang.Number]

Not sure if I am doing something wrong, but the problem occurs somewhere around, I think, getCode().

Commenting out versionCode versionberg.code solves the compilation issue.

@rockerhieu
Copy link
Owner

@cengizkandemir can you try running this command line?

./gradlew versionbergInfo --refresh-dependencies

@rockerhieu
Copy link
Owner

I think I can reproduce the same issue now. Talking a look now.

@rockerhieu
Copy link
Owner

Can you try 1.0.2-SNAPSHOT?

buildscript {
    repositories {
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }
    dependencies {
        classpath 'io.github.rockerhieu:versionberg:1.0.2-SNAPSHOT'
    }
}

apply plugin: "io.github.rockerhieu.versionberg"

If it work then I will release 1.0.2.

@cengizkandemir
Copy link
Author

I'll check it next monday.

@rockerhieu
Copy link
Owner

@cengizkandemir did you check it?

@cengizkandemir
Copy link
Author

cengizkandemir commented Feb 5, 2018

This seems to work. What is the difference between these two releases?

@rockerhieu
Copy link
Owner

There was a bug when initializing Versionberg extension. Cool, let me publish 1.0.2.

rockerhieu pushed a commit that referenced this issue Feb 6, 2018
@rockerhieu
Copy link
Owner

Here it is https://github.com/rockerhieu/Versionberg/releases/tag/releases%2Fv1.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants