JetBrains / intellij-platform-plugin-template

Template repository for creating plugins for IntelliJ Platform
Apache License 2.0
3.05k stars 618 forks source link

MissingVersionException when running patchPluginXml #330

Closed BoD closed 1 year ago

BoD commented 1 year ago

I'm not 100% sure of this because I was using a previous version of the template and I am now updating my project with the latest changes. This means the org.jetbrains.changelog goes from version 1.3.1 to 2.0.0 for me.

On my project currently my changelog looks like this:

<!-- Keep a Changelog guide -> https://keepachangelog.com -->

# My Plugin Changelog

## [Unreleased]
### Added
- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)

When running ./gradlew patchPluginXml, I'm getting:

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':patchPluginXml'.
> Error while evaluating property 'changeNotes' of task ':patchPluginXml'.
   > Failed to calculate the value of task ':patchPluginXml' property 'changeNotes'.
      > org.jetbrains.changelog.exceptions.MissingVersionException: Version is missing: any

This is related to this bit in build.gradle.kts:

        // Get the latest available change notes from the changelog file
        changeNotes.set(provider {
            with(changelog) {
                renderItem(
                    getOrNull(properties("pluginVersion")) ?: getLatest(),  // <- here
                    Changelog.OutputType.HTML,
                )
            }
        })

I think the reason is it can't find my version in the changelog and should fallback to the latest one (Unreleased) but that fails, not sure why.

Replacing getLatest() with getUnreleased() fixes the issue for me.

Ribosome2 commented 1 year ago

got the same problem , they didn't test it when they release the template project ?

hsz commented 1 year ago

The issue is already fixed with: https://github.com/JetBrains/intellij-platform-plugin-template/commit/4d52215dbe0d85a9a8635ab4b7c98bff4188ba7c It'll be released next week, as for now it's available in the next branch.