Skip to content

VERSION_REVISION token not replaced in JDAUtilitiesInfo.java #97

@arif-banai

Description

@arif-banai

Issue Checklist

  • I have checked for similar issues on the Issue tracker
  • I have updated to the latest version of JDA-Chewtils.
  • I have checked the branches or the maintainer's PRs for upcoming bug fixes.

Affected Modules

Commons

Description

The VERSION_REVISION token in JDAUtilitiesInfo.java is never replaced during the build process, causing the literal string @VERSION_REVISION@ to appear in the published artifact.
Location: commons/src/main/java/com/jagrosh/jdautilities/commons/JDAUtilitiesInfo.java

public static final String VERSION_MAJOR = "@VERSION_MAJOR@";
public static final String VERSION_MINOR = "@VERSION_MINOR@";
public static final String VERSION_REVISION = "@VERSION_REVISION@";

Cause(?):

In build.gradle, the sourcesForRelease task only defines token replacements for VERSION_MAJOR and VERSION_MINOR, but not VERSION_REVISION:

task sourcesForRelease(type: Copy) {
    from('src/main/java') {
        filter(ReplaceTokens, tokens: [
            VERSION_MAJOR:    versionInfo.major,
            VERSION_MINOR:    versionInfo.minor
            // VERSION_REVISION is missing!
        ])
    }
    into 'build/filteredSrc'
}

This may be related to #53 but not sure.

Impact:

When using JDAUtilitiesInfo.VERSION, the resulting string is malformed (e.g., 2.2.@VERSION_REVISION@ instead of 2.2.1).

Suggested Fix:

Add VERSION_REVISION to both the versionInfo map and the ReplaceTokens filter, sourcing the value appropriately (e.g., from git tags for releases).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions