thymeleaf / thymeleaf-docs

Thymeleaf documentation
Apache License 2.0
44 stars 54 forks source link

Build fails with gradle 4.8 #68

Closed danielfernandez closed 5 years ago

danielfernandez commented 6 years ago

When trying to execute the documentation generation process with the newest version of Gradle (4.8), this happens:

$ gradle clean

FAILURE: Build failed with an exception.

* Where:
Build file '/home/releases/Repositories/thymeleaf/thymeleaf-docs/build.gradle' line: 18

* What went wrong:
Could not compile build file '/home/releases/Repositories/thymeleaf/thymeleaf-docs/build.gradle'.
> startup failed:
  build file '/home/releases/Repositories/thymeleaf/thymeleaf-docs/build.gradle': 18: unable to resolve class org.gradle.api.plugins.jetty.internal.Monitor
   @ line 18, column 1.
     import org.gradle.api.plugins.jetty.internal.Monitor
     ^

  1 error

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

It seems something we depend on has changed location, or does not exist anymore.

I tried to update Gradle because the version we are still using (2.12) does not support Java 10.

ultraq commented 6 years ago

Ooo, try use the gradle wrapper instead, gradlew (command) so that it uses the version of Gradle that's known to work with the docs. That way, the build will use the version of Gradle that we've said still works with the docs, while you can still have a different version globally installed.

ultraq commented 6 years ago

Ah, but if you want Java 9+ on that machine, then yeah I'll have to update the build process to work with newer versions of Gradle. (On my own machine I've got jenv installed which so that I can have multiple versions of Java installed and use 8 for this project.)

danielfernandez commented 6 years ago

Similar issue using JDK 11 with ./gradlew:

$ ./gradlew generateDocs

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '11'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
ultraq commented 5 years ago

Am trying to sort this out this weekend. Seems a lot of the things we relied on in Gradle 2 have been deprecated and removed, so I'm trying out alternatives without hopefully changing too much about how we go about building things.

ultraq commented 5 years ago

I've updated the dev branch with some changes that should make it run on recent Gradle (updated the wrapper to use the latest version 4.10.2) and Java 11 (running OpenJDK on my Mac). The biggest change was finding some community plugins to replace the removal of Gradle's the built-in Jetty server that work with Java 11. The plugins are using OSS-friendly licences.

Despite all that, the document creation process is still the exact same commands as they were before 😀 So give them a try when you're able @danielfernandez, and then we can update master and close this issue.

danielfernandez commented 5 years ago

I did a ./gradlew clean generateDocs on the current state of the dev branch (using JDK 11) and after a while I got an error in the PDF generation phase:

[...]
> Task :generateDocsPDF
Generating PDF doc for tutorials/2.1/extendingthymeleaf (tutorials)...
Generating PDF doc for tutorials/2.1/usingthymeleaf (tutorials)...
Generating PDF doc for tutorials/2.1/thymeleafspring (tutorials)...
Generating PDF doc for tutorials/2.1/usingthymeleaf_ja (tutorials)...
Generating PDF doc for tutorials/3.0/extendingthymeleaf (tutorials)...
Generating PDF doc for tutorials/3.0/usingthymeleaf (tutorials)...
Generating PDF doc for tutorials/3.0/thymeleafspring (tutorials)...
Generating PDF doc for tutorials/3.0/usingthymeleaf_ja (tutorials)...

Error: Failed loading page http://localhost:8080/thymeleaf-docs/tutorials/3.0/usingthymeleaf_ja.html (sometimes it will work just to ignore this error with --load-error-handling ignore)
Exit with code 1 due to network error: ConnectionRefusedError

> Task :generateDocsPDF FAILED

FAILURE: Build failed with an exception.

* Where:
Build file '/home/releases/Repositories/thymeleaf/thymeleaf-docs/build.gradle' line: 292

* What went wrong:
Execution failed for task ':generateDocsPDF'.
> java.io.IOException: Stream closed

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 36s
7 actionable tasks: 7 executed

It does look like some kind of network error when connecting to the webserver rendering the HTML in order to convert it to PDF… maybe some kind of thread synchronization error at the gradle side (perhaps the client connecting when the server has already stopped serving the content…)

But funny enough, I tried a second time and…

BUILD SUCCESSFUL in 2m 29s
7 actionable tasks: 7 executed

😆

Then I tried a third time, and again it worked fine. So maybe it was just a matter of very bad luck caused by some weird planetary conjunction. I can live with a few retries in this process to be honest, after all it's only executed 4-5 times per year…

ultraq commented 5 years ago

Odd, but if you're OK with that, then I'm OK with that too 👍 I had that error happen to me when I started but not towards the end so I thought something I did fixed it up.

danielfernandez commented 5 years ago

dev branch merged into master