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

Can't get examples working #7

Closed
pescadorbob opened this issue Jan 22, 2016 · 4 comments
Closed

Can't get examples working #7

pescadorbob opened this issue Jan 22, 2016 · 4 comments

Comments

@pescadorbob
Copy link

As I've been running through gradle in action examples using this code, they don't work. I've been using the gradle wrapper, but it complains about:
A problem occurred evaluating script.

java/util/HashMap$Entry

If I try to upgrade to 2.1, then I get this error:
D:\work\todo>gradle wrapper --gradle-version 2.1
:buildSrc:clean
:buildSrc:compileJava UP-TO-DATE
:buildSrc:compileGroovy
:buildSrc:processResources UP-TO-DATE
:buildSrc:classes
:buildSrc:jar
:buildSrc:assemble
:buildSrc:compileTestJava UP-TO-DATE
:buildSrc:compileTestGroovy UP-TO-DATE
:buildSrc:processTestResources UP-TO-DATE
:buildSrc:testClasses UP-TO-DATE
:buildSrc:test UP-TO-DATE
:buildSrc:check UP-TO-DATE
:buildSrc:build
Loading configuration for environment 'test'.

FAILURE: Build failed with an exception.

  • Where:
    Script 'D:\work\todo\gradle\jacoco.gradle' line: 11

  • What went wrong:
    A problem occurred evaluating script.

    Failed to apply plugin [class 'org.ajoberstar.gradle.jacoco.plugins.JacocoPlugin']
    java.lang.String cannot be cast to org.gradle.api.artifacts.Configuration

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.662 secs

D:\work\todo>

Is there any kind of way to migrate forward so I can make it through the examples in your book?

@bmuschko
Copy link
Owner

As I've been running through gradle in action examples using this code, they don't work.

I am automatically executing most of the code example with the checked in Wrapper version via CI. Which code example does not work for you with the checked in Wrapper?

D:\work\todo>gradle wrapper --gradle-version 2.1

In this case you are not using the Wrapper. You are using the Gradle distribution installed on your machine. Keep in mind that the command line option --gradle-version was introduced with a 2.x version of Gradle so the checked in Wrapper (based on 1.7) wouldn't know anything about it. Instead of using the wrapper task, you can manually update the version in gradle/wrapper/gradle-wrapper.properties.

It's unlikely that all of the code example will be compatible with a Gradle 2.x version simply because the Gradle API has breaking changes between major versions.

Script 'D:\work\todo\gradle\jacoco.gradle' line: 11

This leads me to believe that you are executing the command against a different repository. Correct?

@pescadorbob
Copy link
Author

Hi, thanks for the quick response. I am running the example using the wrapper from jenkins, but I get the error:
A problem occurred evaluating script.
java/util/HashMap$Entry

as in Figure 13.11 from your book. Perhaps it has something to do with the JDK, or something.

because the wrapper didn't work, I decided to try it out from an updated gradle version. Bad idea, I guess.

I am running it from a forked repository, correct.

Maybe I should use a different JDK and then the examples would work? Is there a way to migrate forward, beside trial and error hell? I didn't see in the readme the exact JDK that is needed. I would have hoped it would be backwards compatible. But, I'll try out jdk 1.7 and 1.6 to see if the examples work better.

Thanks.

@pescadorbob
Copy link
Author

JDK 1.7 resolved it.

@bmuschko
Copy link
Owner

Hi, thanks for the quick response. I am running the example using the wrapper from jenkins, but I get the error:
A problem occurred evaluating script.
java/util/HashMap$Entry

This is mentioned in the documentation: If you are using JDK8, you will want to build the code with a Gradle version >= 2.0.. I guess that's the reason you are upgrading.

I am running it from a forked repository, correct.

The repository you are running here is more an add-on to the actual code of the book. I'd recommend opening an issue in the corresponding repository. It confused me first what code you were referring to.

Maybe I should use a different JDK and then the examples would work? Is there a way to migrate forward, beside trial and error hell? I didn't see in the readme the exact JDK that is needed. I would have hoped it would be backwards compatible. But, I'll try out jdk 1.7 and 1.6 to see if the examples work better.

It generally should be forward-compatible. I know that the Jacoco plugin won't work though. At the point of writing the book, this plugin wasn't part of Gradle core yet. When I get time again, I will touch up the code example.

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