Maven resource filtering not executed

I have a Dockerfile containing the following line:

ENTRYPOINT ["java", "-Dconversion.rules.folder=/var/rules", "-jar", "/var/gateway-service-${project.version}.jar"]

I am configuring the maven-resources-plugin as following:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.1.0</version>
    <executions>
        <execution>
            <id>copy-docker-artifacts</id>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <phase>package</phase>
            <configuration>
                <resources>
                    <resource>
                        <directory>${project.build.directory}</directory>
                        <includes>
                            <include>${project.artifactId}.tar</include>
                        </includes>
                    </resource>
                    <resource>
                        <directory>${project.basedir}/src/main/docker</directory>
                        <filtering>true</filtering>
                    </resource>
                </resources>
                <outputDirectory>${project.build.directory}/docker</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

As you can see I am expecting the project.version to be replaced. For some reason this is not true. I have then ran the build using debug mode and it outputs the following:

[INFO] Copying 1 resource
[DEBUG] Copying file Dockerfile
[DEBUG] file Dockerfile has a filtered file extension
[DEBUG] filtering ...srcmaindockerDockerfile to ...targetdockerDockerfile
[DEBUG] no use filter components

It seems to me that the filtering should be working, however the file in target still contains ${project.version}. What am I missing here?

Source: StackOverflow