Skip to content

[paper-plugin.yml] The ${project.version} variable don't work with Maven #11874

Description

@x9nico

Expected behavior

I have an oldest plugin who's really big (+130 classes) since 2016. I'm working on an update to Paper 1.21.4.

I started to update my plugin to latest Paper features (paper-plugin.yml, Brigadier commands, etc.)

On typping /version PvPBox, it should return the version with the ${git.commit.id.describe-short}. Since I migrated to paper-plugin.yml, it don't work.

Observed/Actual behavior

It shows the name of the variable instead of my version.
Image

Steps/models to reproduce

  1. Create a paper-plugin.yml (very basic : package.Main class, Name, author, version, api-version)
  2. On your pom.xml, add into <builds> the plugin git-commit-id-maven-plugin (version 9.0.1).
  3. Into <version> set it to <version>3.0.0 (${git.commit.id.describe-short})</version>
  4. Set this into your paper-plugin.yml : version: ${project.version}

Plugin and Datapack List

No datapacks.
Image
Note: PvPBox is my plugin.

Paper version

[23:42:52 INFO]: Checking version, please wait...
[23:42:53 INFO]: This server is running Paper version 1.21.4-68-main@9298f59 (2024-12-30T20:42:05Z) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21.4-66-d00344a (MC: 1.21.4)

Other

My paper-plugin.yml :

main: fr.x9nico.pvpbox.PvPBoxPlugin
name: PvPBox
author: x9nico
website: https://x9nico.fr
version: ${project.version}
api-version: '1.21.4'
dependencies:
  server:
    PlaceholderAPI:
      load: BEFORE
      required: true

My full pom.xml :

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>fr.x9nico</groupId>
    <artifactId>PvPBox</artifactId>
    <version>3.0.0 (${git.commit.id.describe-short})</version>

    <repositories>
        <repository>
            <id>papermc</id>
            <url>https://repo.papermc.io/repository/maven-public/</url>
        </repository>
        <repository>
            <id>spigot-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>minecraft-repo</id>
            <url>https://libraries.minecraft.net/</url>
        </repository>
        <repository>
            <id>viaversion-repo</id>
            <url>https://repo.viaversion.com</url>
        </repository>
        <repository>
            <id>placeholderapi</id>
            <url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
        </repository>
    </repositories>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>plugin.yml</include>
                    <include>config.yml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>config.yml</exclude>
                    <exclude>plugin.yml</exclude>
                </excludes>
            </resource>
        </resources>
        <plugins>
            <!-- Unit tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.2</version>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <release>21</release>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.6.0</version>
                <configuration>
                    <relocations>
                        <relocation>
                            <pattern>org.bstats</pattern>
                            <shadedPattern>fr.x9nico.pvpbox</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>fr.mrmicky.fastboard</pattern>
                            <shadedPattern>fr.x9nico.pvpbox.utils.fastboard</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.github.git-commit-id</groupId>
                <artifactId>git-commit-id-maven-plugin</artifactId>
                <version>9.0.1</version>
                <executions>
                    <execution>
                        <id>get-the-git-infos</id>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>io.papermc.paper</groupId>
            <artifactId>paper-api</artifactId>
            <version>1.21.4-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>5.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.36</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.mojang</groupId>
            <artifactId>authlib</artifactId>
            <version>6.0.57</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.18.0</version>
        </dependency>
        <!-- bStats -->
        <dependency>
            <groupId>org.bstats</groupId>
            <artifactId>bstats-bukkit</artifactId>
            <version>3.1.0</version>
            <scope>compile</scope>
        </dependency>
        <!-- junit 5, unit test -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.11.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>5.14.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>5.14.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.viaversion</groupId>
            <artifactId>viaversion-api</artifactId>
            <version>LATEST</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>me.clip</groupId>
            <artifactId>placeholderapi</artifactId>
            <version>2.11.6</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

</project>

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions