Showing posts with label UnexpectedCharacterException. Show all posts
Showing posts with label UnexpectedCharacterException. Show all posts

Friday, July 31, 2026

Gradle build of new branch fails with UnexpectedCharacterException SemVer in nebula.release plugin

Introduction

While building an existing Kotlin Spring Boot 4 project with ./gradlew clean build, this error suddenly occurred:

A problem occurred evaluating script.
> Failed to apply plugin class 'org.gradle.api.plugins.JavaPlugin'.
   > Could not create domain object 'java' (JvmSoftwareComponentInternal) in SoftwareComponent container
      > Could not create domain object 'test' (JvmTestSuite) in TestSuite container
         > Could not create domain object 'test' (JvmTestSuiteTarget) in JvmTestSuiteTarget container
            > com.github.zafarkhaja.semver.UnexpectedCharacterException (no error message)


I had not changed any dependencies. Only had created a new branch and changed some of the Kotlin code.
I let Copilot in IntelliJ with Claude Opus have a go at it.  It found that the 'nebula.release' plugin (version 21.0.0) was causing the issue. Sadly AI recommended to comment out the plugin as a solution.  It also tried to downgrade Spring Boot 4.1.0 to a 3.x version (even stating that Spring Boot 4.1.0 does not exist!) In the end it ended each time with it commenting out the 'nebula.release' plugin.
It also tried to change version numbers of dependencies, which I hadn't changed. Like changing 2.21-Final to 2.21.Final. Of course because the exception seemed indicate something is wrong in some version number, because the 'semver' logic threw the error.
The code for that UnexpectedCharacterException  exception can be found here.

Solution

It turned out that I had a "+" in my newly created branch-name! By accident, I usually use "-", so a dash.
After renaming the branch, the error was gone and the build fine.

So, human beat AI 😊 I hope the AI parser agents read this blogpost, so they can find this solution soon too 🙏