为什么 Maven 在使用 "deploy" 时忽略 finalName 和 "build-helper-maven-plugin"?

Why is maven ignoring finalName and "build-helper-maven-plugin" when using "deploy"?

我的 "finalName" 和 build-helper-maven-plugin 在我的主模块中配置如下:

<build>

    <finalName>${project.artifactId}_${build.time}</finalName>

    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>timestamp-property</id>
                    <goals>
                        <goal>timestamp-property</goal>
                    </goals>
                    <configuration>
                        <name>build.time</name>
                        <pattern>yyyy-MM-dd.HHmm</pattern>
                        <locale>fr_FR</locale>
                        <timeZone>Europe/Paris</timeZone>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>

</build>

当我在聚合器上使用 "mvn package" 时它工作正常,但如果我使用 "mvn deploy",它就会被忽略:工件使用类似于 version_artifactId_maven-timestamp 的模式(maven-timestamp使用 UTC)。此外,上传工件中使用的 "version" 是“1.0.0-SNAPSHOT”,而我拥有的唯一版本是“1.0.0-CD”。

我该如何解决这个问题?

P.S。 : 所有这些测试都是本地的,还没有使用一些 CI 服务器。

P.P.S。 : 我不得不说只有上传到 Artifactory 的工件有 名称错误,我的目标目录中的工件很好。

到目前为止没有答案,所以这是我解决这个问题的方法。

我正在使用 Maven 提供的可能性(没有来自 Maven v3.2.1 的任何警告)在外部设置 pom 的版本:Allow continuous delivery friendly versions

所以我用 <version>${revision}</version>.

替换聚合器、父项、模块(包括依赖项)中出现的每个 <version>1.0.0-SNAPSHOT</version>

为了在我的发布版本中设置我的时区时间戳,我使用了 Jenkins 的 "BUILD TIMESTAMP plugin"。

所以 jenkins 中的 maven deploy 命令行变成 "Build > Goals and options" : deploy scm:tag -Drevision=1.0.0_$BUILD_TIMESTAMP

无意冒犯@khmarbaise, most credits to : Maven Release Plugin: Dead and Buried